input: make <Tab> indent only when mark and cursor are on different lines

It allows entering a TAB character at the cursor position while the
mark is on the same line as the cursor, as some users sometimes do.

This refines the feature that was added in version 2.9.2, and makes
it behave like in the Gedit and Kate editors, for example.

This addresses https://savannah.gnu.org/bugs/?57357.
Reported-by: Sébastien Desreux <seb@h-k.fr>
master
Benno Schulenberg 2019-12-02 16:56:41 +01:00
parent 076eb6f6af
commit 0271e4a187
1 changed files with 2 additions and 1 deletions

View File

@ -658,7 +658,8 @@ int parse_kbinput(WINDOW *win)
#ifndef NANO_TINY
/* When <Tab> is pressed while the mark is on, do an indent. */
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN)
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN &&
openfile-> mark != openfile->current)
return INDENT_KEY;
#endif