but at the same time editors typically have shortcuts to indent single line
despite where the cursor is with a single keypress.
afair leo didnt, and it was a pain (some more key pressing to select a
line, which leo surprisingly cannt do from the middle of the line too - so
user must first move cursor to the very beginning of the line)
so to be like all other editors leo should have 2 commands: indent-region
and indent-line

i use your current fix w/o special handling of tabs and I am VERY happy! i
vote not to change it.

вт, 17 нояб. 2020 г. в 19:20, Edward K. Ream <[email protected]>:

>
> The fix to #1731 <https://github.com/leo-editor/leo-editor/issues/1731>
> has created a new bug. With the default bindings, it is not possible to
> insert whitespace at the end of the line by typing a tab. Instead:
>
> - Typing a tab character *anywhere* on a line inserts leading whitespace
> (lws).
> - When multiple lines are selected, a tab character increases the lws of
> all selected lines.
>
> *Background*
>
> Leo 6.3 substantially revised how Leo handles all incoming keystrokes. As
> the result of those changes, the indent region command (in
> commanderEditCommands.py) contains the following dubious code:
>
> if sel_1 == sel_2:
>      c.editCommands.selfInsertCommand(event)
>      return
>
> This *kinda* works. In particular, it (mostly) works when indent-region
> is bound to the tab character, which is the default binding. However, the
> hack requires that existing users change their bindings, as reported here
> <https://groups.google.com/g/leo-editor/c/Ye_X3gT4YRk/m/XLN7KspuAQAJ>.
>
> *Handling tabs and insert-region*
>
> Editors typically do the following with tabs:
>
> - When multiple lines are selected, a tab indents those lines.
> - When there is no selection, a tab inserts a (hard or soft) tab a the
> insertion point.
> - When there is a selection on a single line, a tab replaces that
> selection.
>
> Alas, Leo has no way to change key bindings based on the selection range.
> This means that tab (indent-region) *must* handle the special cases list
> above.
>
> *Handling shift-tab and unindent region*
>
> Editors typically do the following:
>
> - Shift-tab unindents all selected lines.
> - Shift-tab unindents one line if there is no selection or the selection
> doesn't cross lines.
>
> This is much easier to handle because Shift-tab is not an "insertable"
> character.
>
> *Summary*
>
> The code in devel does not properly handle tab characters at the end of a
> line. Ditto for the ekr-undo branch, which is based on devel. Ditto for Leo
> 6.3 in the master branch.
>
> The indent-region command must handle the special cases listed above. More
> complex tests will be required. I have just reopened #1731
> <https://github.com/leo-editor/leo-editor/issues/1731>.
>
> All comments welcome.
>
> Edward
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/leo-editor/191afa5a-95ef-4fc6-82cd-a92fd74d8f0dn%40googlegroups.com
> <https://groups.google.com/d/msgid/leo-editor/191afa5a-95ef-4fc6-82cd-a92fd74d8f0dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAC%2B8SVw%3DFHca4WKwcb8bPb3%3DLmc%3Dqv%2Bu5-Y-Zo%2Bu76MCYVkaxw%40mail.gmail.com.

Reply via email to