News for hackers. Stuff that matters.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by qwertox on Thursday March 28, 2024 @01:46PM (#39854997)
Notepad++ (and this one here) are based on Scintilla [0]. It's worth pointing it out because it is a high-quality open source code editor component.

SciTE [1] is the "official" demo-editor for Scintilla and was last updated on March 9th 2024. The history reaches back to 1999.

[0] https://www.scintilla.org/

[1] https://www.scintilla.org/SciTE.html

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by kiney on Thursday March 28, 2024 @02:29PM (#39855589)
I really like geany, which is also based on scintilla
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by speps on Thursday March 28, 2024 @01:51PM (#39855066)
I wrote a custom mod more than 15 years ago for SciTE that exposed its plugin API to Ruby and wrote some of my own plugins. It didn't support multiple cursors and I instantly switched to Sublime as soon as I discovered that feature, never looked back.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by jmole on Thursday March 28, 2024 @02:23PM (#39855512)
What are multiple cursors used for?
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by rezonant on Thursday March 28, 2024 @04:56PM (#39857215)
Any time you need to make the same edits in multiple places. I use it to mass edit array items for example by using the highlight / add cursor to identical text feature in VS Code (Ctrl+D). I even use it to copy data out of the browser and mass edit it into data structures-- often there will be some pattern to the pasted data even if it's garbage, so being able to quickly set up multicursors around the patterns in the text makes this sort of task much easier, if you are luckily on how the data pastes out.

Multicursors are the number one editor innovation of the last ten years that developers should get comfortable with-- once you start to use them you won't want to use an editor without them.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by innocenat on Thursday March 28, 2024 @11:30PM (#39860390)
Personally while there are some task that's easier with multiple cursors, I have personally yet to find any use case where regexp replace in selections doesn't work as well.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by germandiago on Thursday March 28, 2024 @11:40PM (#39860456)
I find Emacs Macros and rectangular editing as more useful in lore situations than multiple cursors.

As for regexps, the syntax in Emacs is hell, but I do know Emcacs has very powerful edit/replace tools.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by cylinder714 on Friday March 29, 2024 @01:19AM (#39860960)
"Emcacs"...I like it.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by germandiago on Friday March 29, 2024 @06:20AM (#39862399)
Yeah... typing fast and from the phone has this problem
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by overtomanu on Friday March 29, 2024 @05:28AM (#39862099)
Multi-cursor is more flexible than rectangular selection. You can skip or delete words of varying length etc. It is certainly less powerful than vim macro and regex, but it's easy to use because 1) there are less shortcuts to remember 2) no need to think too much like figuring out regex for simple tasks 3) it gives instant feedback

Video showing this https://youtu.be/lhFNWTAIzOI?t=28

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by siproprio on Saturday March 30, 2024 @04:31AM (#39872947)
skill issue tbh
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by edflsafoiewq on Friday March 29, 2024 @01:33AM (#39861008)
There's a reason people use visual editors and not ed.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by treflop on Friday March 29, 2024 @02:25AM (#39861222)
Wouldn’t remotely compare regex to ed.

I also haven’t found a use for multiple cursors.

Writing a regex is quick and easy.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by madacol on Friday March 29, 2024 @08:41AM (#39863358)
You cannot edit in real-time with regex

With regex, you need to plan everything you need to do and then surgically do it.

With multiple cursors, you only need to know (roughly) where you need to change, the rest you figure it out on the fly.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by lf-non on Friday March 29, 2024 @11:23AM (#39865175)
In editors like vim/emacs it is possible and common.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by lenkite on Friday March 29, 2024 @02:29AM (#39861246)
I guess with rectangular selection and macros, VIM folks don't find much use for multiple cursors.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by twodave on Thursday March 28, 2024 @03:18PM (#39856164)
I use it to:

* transform a list of field names into different formats (class properties, sql select list, etc.)

* quick and dirty convert delimited text into insert statements or graphql queries or json objects

* really anything I need to change in column mode but with better tracking of words via mod+arrow keys

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by nolongerthere on Thursday March 28, 2024 @03:24PM (#39856242)
I use it daily in vscode to clean up small data sets where wrangling regex will take more time, and the data set isn’t something that I’m gonna see again so it’s not worth generalizing a solution.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by blacksmith_tb on Thursday March 28, 2024 @03:22PM (#39856209)
I use it all the time to mangle small amounts of data, like selecting all the newlines in a file with cntrl-d and making them into "," to make it into values for an array or something (obv. search+replace could do that, still it's quicker for a small number this way, or feels like it). It was pretty slick in the early TextMate / Sublime days to see people editing html and making a big bunch of tags all write themselves out simultaneously.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by input_sh on Thursday March 28, 2024 @02:40PM (#39855724)
If you're using the same variable name across the file, but want to change only a couple of references to something else, it fills that "I need to do this more than once, but in a bit of an easier to reach, fancier way than with find and replace" niche.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by AeroNotix on Thursday March 28, 2024 @04:38PM (#39857023)
Most editors these days should have "rename" functionality which is very aware of how that symbol is used across a codebase.

M-x lsp-rename in emacs, for example works great, if you're using lsp.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by rezonant on Thursday March 28, 2024 @04:59PM (#39857240)
Yes but this is more general, allowing you to use it in more cases. For instance, I use it heavily when converting old JavaScript to modern ES/TS. Using "var" everywhere? Replace them all with let. Using anonymous functions instead of lambdas, easy to change those all over (provided there's no "this" dependencies)

Have two thousand strings which all need the same edits? No need to do a find/replace operation, you can do it directly in the editor.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by layer8 on Thursday March 28, 2024 @05:41PM (#39857682)
How do you select those two thousand strings?
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by zimmund on Thursday March 28, 2024 @08:49PM (#39859328)
Using VS Code: select whatever you want to match, then Ctrl+Shift+L
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by layer8 on Thursday March 28, 2024 @10:18PM (#39859907)
So it has to be two thousand identical strings? Then I don’t understand the benefit over search & replace.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by kemayo on Thursday March 28, 2024 @11:02PM (#39860189)
It doesn't have to be identical. For the method they're describing you just have to get search results -- so you can use regex in that. You can also just command-click anywhere you want to leave a new selection-point. (Or use various other find commands that search for things and add them to your selection pool.)

The benefit of it is that you're left with a cursor in each location, and you can then do absolutely anything that you'd normally do with a single cursor in every place at once. This includes things like copy/paste, which will maintain a separate buffer in each selection. This also includes things that're actually tough to do with normal find/replace -- I could select the bit after a search result and switch it to title-case, for instance.

You can do most things you'd use it for with find/replace. But sometimes it's easier to watch it happen as you type, rather than construct a fairly complex regex with groups and suchlike.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by rezonant on Thursday March 28, 2024 @10:54PM (#39860124)
It goes further than just that -- for instance, lets say your data looks like this:

    [
        "foo bar/2322",
        "foo baz/4223",
        "foo blah/2232",
        ...
    ]
And you need to reformat that into:

    [
        "bar 2322: foo",
        "baz 4223: foo",
        "blah 2232: foo",
        ...
    ]
You can absolutely use a regular expression find/replace to solve this. But using multicursors, you can just highlight the first "foo ", then hold Ctrl+D to select all instances, then hit right arrow key so that your cursors are at "foo |bar/2322" (and nothing is selected) et al, then use shift+right arrow key to select bar, baz, blah, and all other substrings, then use ctrl+X to cut that list to your clipboard. Hit delete key to get rid of the /s and add a space so you can keep the fields separated. Then, use ctrl+arrow to move your cursors to just before foo ("|foo /2322"), paste, hit space. Now you have "bar foo 2322". Repeat the same action to cut all the "foo" substrings, then move your cursor to the end, now type ": " and then paste.

You get the idea. It sounds complex, but these are all just comprised of the same fundamental editing patterns-- all of the cursors act as if you had just that one cursor when you press the keys. You have to play with multicursors to really appreciate their power.

Most of the time, someone who is well versed with multicursors and their editor's cursor shortcuts (arrow keys, page up/down, shift/ctrl arrow keys, etc) will be able to complete these sort of textual manipulations much faster than using find/replace.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by layer8 on Friday March 29, 2024 @09:26AM (#39863840)
Okay, that particular use case I know as column or vertical select mode.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by brimwats on Friday March 29, 2024 @11:49AM (#39865501)
you can have rows between the columns is the key difference
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by lelanthran on Friday March 29, 2024 @04:12AM (#39861695)
> Have two thousand strings which all need the same edits? No need to do a find/replace operation, you can do it directly in the editor.

I might be missing something here, but how is making 2000 individual selections better than `:%s/oldstring/newstring/g`?

I'm guessing that you have a rule for setting up those 2000 selection, or something?

I mean, even for like 5 identical edits, the regex is going to be faster, so you must have a short way of performing the multi-selection.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by neoromantique on Thursday March 28, 2024 @04:59PM (#39857241)
It helps when it is a bit more interactive, i.e when I only need to replace some of the occurrences versus everything.

Also when working with lists it is useful, you spawn cursors on , or < or whatever symbol you've got at a fixed location between lines, and then you can manipulate text in any number of otherwise different lines.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by jdc0589 on Thursday March 28, 2024 @02:28PM (#39855580)
been a while since I used it, but it was handy for templates where you need to enter a name once and have it typed in multiple places in the template (quicker than a find/replace). It was a also handy sometimes to just be able to put your cursor on the name of a variable or bigger text selection, smash cmd+d a handful of times to add another cursor at every other occurrences of it in the file, and then just start typing to modify each of those occurrences.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by zozbot234 on Thursday March 28, 2024 @03:53PM (#39856545)
Yes, unfortunately it seems that the Scintilla codebase is far from async-ready which will make it a challenge to support new stuff like LSP. We might get tree-sitter parsing support, though.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by Aachen on Thursday March 28, 2024 @08:08PM (#39859046)
What's LSP?
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by mustardo on Thursday March 28, 2024 @08:37PM (#39859253)
LSP (Language Server Protocol) a way for editors to talk to language tools to provide auto complete, warnings errors etc. this means the language tools can be written once and then any editor that has LSP support can use it https://en.m.wikipedia.org/wiki/Language_Server_Protocol
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by zogrodea on Thursday March 28, 2024 @08:44PM (#39859301)
Language Server Protocol.

It's more or less a way for standaline plugins/programs to provide language-specific functionality like autocompletions, syntax-highlighting, and diagnostic errors (like type errors) independently of a specific editor.

The idea is that standalone programs are made called language servers which can provide these features. Editors tend to communicate with them using JSON-RPC over stdin. So one can only write a language-specific parser once and integrate it with any editor.

Usually (at least in VS Code), there's a third part which is an editor-specific plugin which contains custom code to connect the editor to the language server, but this part is meant to be a thin layer.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by DEADMINCE on Thursday March 28, 2024 @02:35PM (#39855671)
As much as I love npp, really all I need is sessions, tabs and spellcheck. Maybe a few other minor features.

I've been wanting/meaning to make a new text editor using SciTE as a base, just adding in that core functionality that I need, but I haven't got around to it.

If this NPN uses flatpacks I'm not really interested though. I want something super lightweight and fast that can be run as close to standalone as possible.

Might be time to move the text editor project to the top of my list, since it seems other people would probably also appreciate it.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by soco on Thursday March 28, 2024 @04:54PM (#39857198)
And formatting! Don't forget language-aware formatting and maybe even syntax coloring.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by DEADMINCE on Thursday March 28, 2024 @09:15PM (#39859507)
Very true, very important!
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by mananaysiempre on Thursday March 28, 2024 @05:55PM (#39857826)
> I want something super lightweight and fast that can be run as close to standalone as possible.

Unfortunately, I don’t really see how you could make a standalone GUI app of meaningful scope on Linux, given the platform that “standalone” is usually defined with respect to doesn’t include a widget toolkit or even a font handling library (it does on Windows). I guess going it alone with an OpenGL viewport would work, but that’s also just setting yourself up for pain the minute accessibility, font shaping, or input methods come into the picture.

I won’t begrudge anyone writing their own toolkit or shaper, it’s just, that’s far too much work to do for the sake of being “standalone”. For the ideal of doing everything yourself, yes, I can definitely sympathize, but just getting rid of DT_NEEDED records isn’t much of an ideal.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by DEADMINCE on Thursday March 28, 2024 @09:17PM (#39859513)
> Unfortunately, I don’t really see how you could make a standalone GUI app of meaningful scope on Linux, given the platform that “standalone” is usually defined with respect to doesn’t include a widget toolkit or even a font handling library (it does on Windows).

Fair point. I meant able to run without needing any special libraries above those that can be assumed to be installed on a standard linux desktop.

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by someone7x on Thursday March 28, 2024 @02:44PM (#39855775)
I fondly remember SciTE from when I first cut my teeth on desktop automation. I’m glad to see it alive and kicking.

https://www.autoitscript.com/wiki/SciTE4AutoIt3

Re:NotepadNext – a cross-platform reimplementation of Notepad++ by anonnon on Thursday March 28, 2024 @05:20PM (#39857450)
wxWidget's wxStyledTextCtrl is based on Scintilla, too: https://wiki.wxwidgets.org/WxStyledTextCtrl
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by dajt on Thursday March 28, 2024 @07:21PM (#39858654)
I used Scintilla as the editing component for a JavaScript IDE about 20 years ago, was good.
Re:NotepadNext – a cross-platform reimplementation of Notepad++ by pwdisswordfishc on Friday March 29, 2024 @11:30AM (#39865276)
Speaking as someone who uses SciTE daily and has dug into the code, there is nothing high-quality about it.