Solution for horrible bug in nano that renders the text editor completely useless.

EDIT: This solution will be implemented in the nano rpm and should soon be available as upgrade in PCLinuxOS repositories via Your package manager.

Thank You gseaman.

Hi all.

I have noticed this ages ago and it annoyed the BeeGeeses out of me. When You enter a long line of text in nano editor it “wraps” the lines. It “wraps” them like other text editors do – fine. The problem occurs when You try to save the file… all of the sudden long line of text becomes 3 or 4 lines of text… I have recorded this little video to show You an example of what I mean. Now imagine using nano on Your /boot/grub/menu.lst file. Edit the line – even just change the vga=xxx mode and when You reboot Your grub is going into “YOU MESSED UP DUDE!” mode.

Solution to this is to run this command from the terminal:

su -c "sed -i 's/# set nowrap/set nowrap/' /etc/nanorc"

and give it a root password when asked for it.

Fixing nano 1.

This will turn off the word wrap completely.

However if You are like me and You like the word wrap option BUT You want to keep one line as one line You may want to use this command as well:

su -c "sed -i 's/# set softwrap/set softwrap/' /etc/nanorc"

This will cause the nano editor to softly wrap the lines and when You will save the file – the lines won’t break. In other words if You will type a long line it will be shown as many rows of text BUT when You will save the file it will still be a one long line. Both commands have to be used in order for the soft wrap to work.

Fixing nano 2.

Thanks to the Andrzej3393, Enlik and Rsanti – guys from the Polish PCLinuxOS IRC channel – for testing and ideas.

Hope this helps somebody someday.