Notepad3 icon indicating copy to clipboard operation
Notepad3 copied to clipboard

To indent a single line is inconvenient

Open chuanliwen opened this issue 1 year ago β€’ 9 comments

To indent a single line you have to press Home (or by clicking) to get to the beginning of the line and then press Tab. When the line is wrapped you could select the whole line and press Tab, like the case of multi-lines.

Can we use Tab to indent a single line by selecting the line through clicking at the line number? Currently this will replace the line with a tab char. But for multi-lines pressing Tab works as one expects. I don't think this is a good arrangement, for if you want to clear the line you have many ways.

So I suggest we should make indentation more easier for a single line.

  1. Select the whole line (or part of it, if it is wrapped) by clicking on the line number, then press Tab.
  2. At any place of the line, use Ctrl+Tab to indent it, and Ctrl+Shift+Tab to unindent it.

Pls see if these ideas make sense.

chuanliwen avatar Nov 16 '23 15:11 chuanliwen

Can we use Tab to indent a single line by selecting the line through clicking at the line number? Currently this will replace the line with a tab char.

Hello @chuanliwen , I cannot reproduce your Issue. When I select the Line by clicking on the Line number and then press Tab, the Tab is just added at the start of the line and the line is not replaced with a Tab? πŸ€”

2023-11-20_125708

hpwamr avatar Nov 20 '23 12:11 hpwamr

Hi @hpwamr,

Sorry for the confusion. It seemed to be a little tricky, for I did repeat it several times using a previous version before I posted the previous message.

Now again to confirm the behavior of Tab on several cases:

  1. A single line without wrap. -- Click on the line number to select the line, then press Tab, tab is added to the line. 图像 1

  2. A single line with wrap. --Click-drag on the line number area to select the whole line, then press Tab, it behaves as a line without wrap: tab is inserted at the beginning of the line. 图像 13

--Click on the line number area to select part of it, then press Tab,

  1. If the last part is selected, a tab char is inserted at the beginning of the line. 图像 3

  2. Otherwise, the selected part is replaced with a tab char. (This one should be checked to unify the behavior.) 图像 5 图像 7

  1. Selecting one whole line with the mouse, whether the line is wrapped or not, then press Tab, the whole line is replaced with a tab char. 图像 9 图像 11

I still hope to get an easy way of indentation for a single line: at any place of the line, use Ctrl+Tab to indent it, and Ctrl+Shift+Tab to unindent it.

Thanks.

chuanliwen avatar Nov 20 '23 15:11 chuanliwen

Hi @chuanliwen , The Tab operations seem completely normal. A long "wrapped" line always remains a single long line even if the presentation "wrap" displays multiple lines. Selecting a line in a "wrap" multiple lines presentation is equivalent to selecting the same words in a "no wrap" presentation. Also, it is therefore completely normal that this selection of a few words in a "wrap" or "no wrap" line is replaced when you type a space, a tab or write a character.

hpwamr avatar Nov 20 '23 18:11 hpwamr

I think @hpwamr makes the point. Selecting only parts of the line ('subline' in case of wrapped long line) should be replaced by TAB (or spaces, if Insert Tabs as Spaces is chosen) if TAB is pressed. An indentation should be made (or reverted Shift+TAB) only, if whole Line (or Block) is selected (which includes the line-breaks). Since NP3 is designed as a Source-Code Editor (where wrapped lines and paragraphs, etc. are far less common) and not as a Text-Processor this behavior should not be changed.

RaiKoHoff avatar Nov 20 '23 23:11 RaiKoHoff

@hpwamr @RaiKoHoff

Selecting a line (no wrap) by clicking on the line number then press Tab, the line is replaced by Tab -- this happens to the last line (without a CR/LF mark). 图像 15

Shortcuts of Ctrl+Tab and Shift+Ctrl+Tab are not assigned to any special operations, so I think we could use them to quicken the operation of indentation/un-indentation.

chuanliwen avatar Nov 21 '23 03:11 chuanliwen

this happens to the last line (without a CR/LF mark).

Hello @RaiKoHoff , I confirm the bug (a bit similar to #5051)! πŸ€” πŸ‘

Shortcuts of Ctrl+Tab and Ctrl+Shift+Tab are not assigned...

About the request to assign Ctrl+Tab and Ctrl+Shift+Tab to "indentation/un-indentation", I think it is not necessary, however I will check the behavior of "VSCode"? πŸ€”

hpwamr avatar Nov 21 '23 05:11 hpwamr

About the request to assign Ctrl+Tab and Ctrl+Shift+Tab to "indentation/un-indentation"

In MS VSCode these sequences of keys are use in "File management":

Ctrl+Tab              Open next
Ctrl+Shift+Tab        Open previous 

However, in Notepad3 the following sequences of keys already exist:

Shift+Tab             Unindent Selected Block.
Ctrl+Tab              Insert Tabulator.

See KeyboardShortcuts.txt:

hpwamr avatar Nov 21 '23 09:11 hpwamr

Hello @chuanliwen , Thanks for your interest and your contributions to Notepad3. πŸ˜ƒ

Question: I would like to add you in the "Acknowledgments" list of Notepad3. Do you agree? πŸ˜‰

hpwamr avatar Nov 21 '23 09:11 hpwamr

Hi @hpwamr,

Question: I would like to add you in the "Acknowledgments" list of Notepad3. Do you agree? πŸ˜‰

With pleasure. As a user of years I thank you all the contributors to Notepad3 for all the hard work to enhance the project and the patience to assess users' requirements and suggestions.

BTW, in Notepad3 Ctrl+Tab functions the same as Tab, so the current shortcut is redundant.

chuanliwen avatar Nov 21 '23 10:11 chuanliwen

Hope PR #5114 fixes behavior of "complete line selected" (excluding line-break).

Ctrl+TAB will not be changed, it is mapped to "forced TAB indentation using Tabs instead of whitespaces".

RaiKoHoff avatar Feb 25 '24 09:02 RaiKoHoff

Hello @chuanliwen ,

Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_6.24.227.1_rc2.paf" or newer, see in issue #1129.

"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.

Also, feel free to test the "BETA/RC Setup", version "Notepad3_6.24.227.1_rc2_Setup" or newer, see the 2nd list in issue #1129.

Comments and suggestions are welcome... πŸ˜ƒ

hpwamr avatar Feb 27 '24 14:02 hpwamr

Hello @RaiKoHoff @hpwamr: Have downloaded and tested the new build.

  1. Line indentation works perpeactly. I think it's a makeshift to place the option in 'Indentation Guide (color)'. Perhaps later you could add a seperate option to hold it, or you could add a help item to guide users.
  2. Tab (indentation) for the last line without a CR/LF character: it is solved. For lines with multi-sublines, I check EmEditor and see their treatment is the same. So just leave it as it is. Thank you for your great work.

chuanliwen avatar Feb 28 '24 03:02 chuanliwen

Not sure if it is because of this topics specific changes or not, but in the latest 227/228 beta releases, now when pressing tab when in column 0 (such as in a new document), NP3 inserts a tab, but also selects it, so if you start typing the tab is removed again, is this a intentional behavior change?

jupester avatar Mar 01 '24 04:03 jupester

Not sure if it is because of this topics specific changes or not, but in the latest 227/228 beta releases, now when pressing tab when in column 0 (such as in a new document), NP3 inserts a tab, but also selects it, so if you start typing the tab is removed again, is this a intentional behavior change?

@RaiKoHoff @hpwamr Confirmed this new issue. Needs to be dealt with.

chuanliwen avatar Mar 02 '24 05:03 chuanliwen

Hello @jupester , @chuanliwen ,

Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_6.24.302.1_rc2.paf" or newer, see in issue #1129.

"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.

Also, feel free to test the "BETA/RC Setup", version "Notepad3_6.24.302.1_rc2_Setup" or newer, see the 2nd list in issue #1129.

Comments and suggestions are welcome... πŸ˜ƒ

hpwamr avatar Mar 02 '24 17:03 hpwamr