GNU nano - Bugs: bug #57796, [Request] smarter...
You are not allowed to post comments on this tracker with your current authentication level.
bug #57796: [Request] smarter whitespace/indentation handling
Submitter: | Saagar Jha <saagarjha> | ||
Submitted: | Wed 12 Feb 2020 12:49:20 AM UTC | ||
Severity: | 1 - Wish | Status: | Wont Fix |
Assigned to: | None | Open/Closed: | Closed |
Jump to the original submission
Mon 03 May 2021 10:26:03 AM UTC, comment #14: |
Benno Schulenberg <bens> |
Mon 02 Mar 2020 12:21:07 AM UTC, comment #13: I do think that the cursor information shown in the status bar isn't the best; maybe I should file a suggestion for that too. I'll work on updating the patch with the new things you brought up. |
Saagar Jha <saagarjha> |
Tue 25 Feb 2020 02:13:59 PM UTC, comment #12: Showing extra information for --constantshow is out of the question: it already shows too much information, so much that it is useless. (What I might be open to is a new option to show an entirely different status bar or title bar, that gives a very concise position indication, something like in vim or dte, but that is an entirely different issue, not to be discussed here.)
|
Benno Schulenberg <bens> |
Tue 25 Feb 2020 11:06:40 AM UTC, comment #11:
|
Saagar Jha <saagarjha> |
Mon 24 Feb 2020 06:49:56 PM UTC, comment #10: (Another example of mixed tabs and spaces: lib/regcomp.c in gnulib. The indent step is two spaces, and instead of eight spaces a tab is used. :| ) |
Benno Schulenberg <bens> |
Mon 24 Feb 2020 04:22:55 PM UTC, comment #9: What other applications or editors are there that do automatic indent detection? Vim doesn't do it (not by default, at least), Geany doesn't do it, Emacs... seems to do it, but it's mostly its auto-indent that's being too clever -- plus, by moving around I can get it to insert spaces when the file is all tab-indented.
|
Benno Schulenberg <bens> |
Fri 21 Feb 2020 10:04:46 AM UTC, comment #8: Appreciate you taking a look :) I revisited how some other applications handle this, and here are some ideas:
|
Saagar Jha <saagarjha> |
Thu 20 Feb 2020 06:47:24 PM UTC, comment #7: When you first proposed this indent-detection thing, I thought: that is nothing for nano. But seeing how nano (with your patch) correctly detects a four-space indent in a Python file, and the normal single-tab indent in nano's C files... Pretty cool.
|
Benno Schulenberg <bens> |
Sun 16 Feb 2020 12:01:34 PM UTC, comment #6: A rough patch implementing detectindent functionality is attached. |
Saagar Jha <saagarjha> |
Fri 14 Feb 2020 11:59:59 PM UTC, comment #5: We should probably use a whitespace character for the option, honestly. How about "- " ("dash space") or "-
|
Saagar Jha <saagarjha> |
Thu 13 Feb 2020 09:44:27 AM UTC, comment #4: Ah! I thought there only wasn't a command-line option to switch on whitespace display, but apparently there isn't a nanorc option either. Hmmm... I've always had the idea of adding a command-line option for this, but we've run out of letters. (The -S is reserved for changing --softwrap from -$, and -O and -q I want to keep in reserve too.) The only usable non-letter character seems to be the slash. How about -/ for turning on whitespace display?
|
Benno Schulenberg <bens> |
Wed 12 Feb 2020 08:50:26 PM UTC, comment #3:
|
Saagar Jha <saagarjha> |
Wed 12 Feb 2020 12:33:13 PM UTC, comment #2: If you have patch for something like 'detectindent' or 'guessindent', I would look at at it. But I'm not going to work on this myself.
where there are two spaces between the caret and the plus. It will make files indented with spaces look ugly, but at least they will not catch you unawares any more. |
Benno Schulenberg <bens> |
Wed 12 Feb 2020 01:08:35 AM UTC, comment #1: Oh, and just to be clear, tabgives (i.e. a language-level setting) is unfortunately not flexible enough for me because I have variation across a single language (e.g. I work with C indented both ways, depending on the project). |
Saagar Jha <saagarjha> |
Wed 12 Feb 2020 12:49:20 AM UTC, original submission:
I use nano to write code. While I personally use tabs to indent my code, occasionally I have to work on code written by heathens who use spaces for indentation and unless I realize this in time and enable the correct settings I get a huge mess when I edit these files. So here's a couple of ideas I thought I might spitball:
|
Saagar Jha <saagarjha> |
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 5 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2021-05-23 | bens | Open/Closed | Open | Closed | |
2021-05-03 | bens | Status | None | Wont Fix | |
2020-02-16 | saagarjha | Attached File | - | Added 0001-Add-an-option-to-detect-indentation.patch, #48419 | |
2020-02-12 | bens | Severity | 3 - Normal | 1 - Wish | |
Summary | [Request] Smarter whitespace/indentation handling | [Request] smarter whitespace/indentation handling |
Powered by Savane 3.13-4448.
Corresponding source code
Nano detecting the current indentation style (tabs or spaces) and unsetting or setting 'tabstospaces' accordingly will not do the right thing when the file used mixed indentation (a tab for a double indent, four spaces for a single indent). So 'detectindent' is for me a "wontdo".
But... the 'guessindent' from your original comment #0 might be worth looking at. It looks easy to implement and would always do the right thing as long as the file itself uses either only tabs or only spaces for indentation. If you want to post a patch for 'guessindent', please open a new issue.