Notepad2e
Notepad2e copied to clipboard
Drag & drop improvement
Notepad2 поддерживает "drop" из стороннего приложения в окно редактора, при этом на место курсора вставляется текст (он зависит от того, что перетащили).
Доработать это поведение: если drop был сделан на позицию пустой строки, т.е. положение курсора при drop между двумя разрывами строк (или после разрыва, а дальше идёт конец документа) - то в дополнение к текущему поведению (вставки текста в этом месте) добавлять также разрыва строки (если вставленный текст не оканчивается на разрыв). Курсор при этом устанавливается после разрыва строки. То есть при выполнении условий внутренне добавлять разрыв строки к вставляемому тексту, остальное поведение будет вытекать из имеющейся реализации.
Для примера, документ (вторая строка пустая):
document
third
Если перетащить ссылку из Firefox на вторую строку, то текущее поведение: Для примера, документ (вторая строка пустая):
document
http://foo.bar|
third
Нужное:
document
http://foo.bar
|
third
Либо документ из одной строки, после которой идёт пустая строка и EOF:
document
|
При drop на вторую строку ссылки должно быть:
document
http://foo.bar
|
А не (текущее поведение - только 2 строки, новая не добавляется):
document
http://foo.bar|
I can test exe in commit effc9b3dbaef921ad667ab67cfbfee2fc9ed5097?
Sure.
It works but in the commit you reference \r and \n. Is it independent of File | Line Endings?
It works but in the commit you reference \r and \n.
Please feel free to check the issues assigned to you with the latest committed exe. Here is my typical workflow:
- Pickup new/open issues for work
- Fix these issues in the sources
- Build test exe and commit it
- Assign back all the issues to you
Is it independent of File | Line Endings?
This feature works properly considering the actually selected option of File | Line Endings: Windows (CR+LF) Unix (LF) Mac (CR)
What I am asking is if this (https://github.com/ProgerXP/Notepad2e/commit/195c1d7f255023ec010a8b6a4ef55ed87beb6b9b):
+ if (bAddNewLine)
+ {
+ data.insert(data.end() - 1, '\r');
+ data.insert(data.end() - 1, '\n');
+ }
...works because internally Scintilla uses Windows newlines and applies File | Line Endings only to the output file when saving?
...works because internally Scintilla uses Windows newlines and applies File | Line Endings only to the output file when saving?
- The code changes for this improvement were made in Scintilla's internals: <scintilla/win32/ScintillaWin.cxx>
- No, newlines are processed in the subsequent call to DropAt()-method which will convert newlines considering the selected type in File>Line Endings:
:
Курсор при этом устанавливается после разрыва строки.
Notepad2 selects dropped text. Currently we do not select it, moving the caret to be after it. Need to combine both approaches:
- When dropping onto an empty line (as explained above), insert a blank line after the dropped text. This is current behaviour.
- Select the dropped text, excluding the added line. This is Notepad2 behaviour.
- When dropping onto an empty line (as explained above), insert a blank line after the dropped text. This is current behaviour.
- Select the dropped text, excluding the added line. This is Notepad2 behaviour.
Point 2 states to follow Notepad2 behavior. But excluding the added line looks excess since there is no new line in Notepad2 on drop. Or do we need to always add new line but not to select it in case of p2?
Or do we need to always add new line but not to select it in case of p2?
This is why I've said "Need to combine both approaches". We need to both add the line break and select the new text (but excluding the added break).
Fixed.
если вставленный текст не оканчивается на разрыв
Current implementation works but need to add a check if the dropped text ends on newline, and if it does then neither add extra newline nor exclude it from selection. In other words, when it ends on newline do a normal drop as in Notepad2.
Fixed.