Only add line break for module syntax when it's needed

Status: Implemented

Created by leiger 28 May 2010 00:20

rating: +4+x

**STE **

Ed Johnson wrote: One thing I noticed is that inserting the module code also inserts a blank line. So instead of [[module … starting on the line the cursor is on, it sends a CR/LF before inserting the code.

This is added in manually to ensure that the module tag is on it's own line.

Instead, STE should check where the cursor is currently located and if it's already on a new line, then the forced line break shouldn't be added in.


wdavatar?user=
(user deleted)

02 Jul 2010 21:01. Edited 0 times. (Edit, Permalink)

Instead, STE should check where the cursor is currently located and if it's already on a new line, then the forced line break shouldn't be added in.

It should do a couple of checks.

  • Get the column position of the cursor.
    • If it's in column 1…
      • and the line is empty, then insert the module code at the position of the cursor.
      • and the line is not empty, then insert the module code at the position of the cursor followed by a CR/LF (to force the existing text to a new line).
    • If it's not in column 1…
      • check to see if you're at the end of the line.
        • If so, insert a CR/LF to start a new line and then insert the module code.
        • If not, insert the module code into column 1 of the current line followed by a CR/LF (to force the existing text to a new line). Or, alternatively, push the cursor to the end of the line and then do the step above.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

03 Jul 2010 01:11. Edited 1 times. (Edit, Permalink)

Ed Johnson wrote:

  • Get the column position of the cursor.

I've added Quote/DeQuote buttons to the next version. For that I had to find a way to detect if the cursor was at the beginning of the line or not.

In the end I couldn't find a way of detecting that (but I don't think I was using the word "column" so I'll have to have another look for that).

The way the Quote/DeQuote feature works at the moment is that it always adds an arrow to the start of the selected text (even if it's not at the start of a line) then after that it searches for end-of-line characters and adds the quote syntax after that (which guarantees that it appears on the start of the following line). It's a bit of a workaround… but it works.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

30 Jan 2011 13:51. Edited 0 times. (Edit, Permalink)
As modules are no longer part of the latest version (they have been replaced by the extensions linked at the end of this post), I'm rejecting this request.


Extensions that replace built-in functionality of STE:

Included page "inc:signature" does not exist (create it now)

wdavatar?user=
(user deleted)

30 Jan 2011 15:23. Edited 0 times. (Edit, Permalink)
This is still an issue. Extensions behave the same way. I'd like to see it addressed at some point, but it falls into the "minor annoyance" category. For example, start with a blank editor and run any extension. The output will always start on line 2. I can live with this since it's easy enough to reposition your text after inserting an extension, but it still annoying. ;)

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

31 Jan 2011 10:18. Edited 0 times. (Edit, Permalink)
Marked TODO instead.

Included page "inc:signature" does not exist (create it now)

Post Reply

Add reply on "Only add line break for module syntax when it's needed"

CSS Theme, Images and Code on this website are © Shane Smith 2010-2012. All forum posts by users and documentation licensed under Creative Commons BY-NC-SA 3.0 License.