Add virtual space ability

Added an option in preferences to enable or disable virtual space.

Fix #11443, Fix #11444, close #11452
pull/11484/head
Manuel Montoto 3 years ago committed by Don Ho
parent 64bfa72bd0
commit 88ed851478

@ -859,6 +859,7 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="6215" name="Gaitu letra-mota leuna"/>
<Item id="6236" name="Gaitu azken lerrotik haratagoko korritzea"/>
<Item id="6239" name="Mantendu hautapena hautapenetik kanpo eskuin-klika egitean"/>
<Item id="6245" name="Espazio virtuaia gaitu"/>
</Scintillas>
<DarkMode title="Modu Iluna">

@ -747,6 +747,7 @@ By Hiro5 <groccat at gmail>
<Item id="6215" name="Activa suavitzat de lletra"/>
<Item id="6236" name="Permet desplaç. després de l'última línia"/>
<Item id="6234" name="Desactiva el desplaçament avançat&#xD;(si teniu problemes amb el touchpad)"/>
<Item id="6245" name="Activar espai virtual"/>
</Scintillas>
<NewDoc title="Document nou">
<Item id="6419" name="Document nou"/>

@ -884,6 +884,7 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="6215" name="Enable smooth font"/>
<Item id="6236" name="Enable scrolling beyond last line"/>
<Item id="6239" name="Keep selection when right-click outside of selection"/>
<Item id="6245" name="Enable virtual space"/>
</Scintillas>
<DarkMode title="Dark Mode">

@ -844,6 +844,7 @@
<Item id="6215" name="Enable smooth font"/>
<Item id="6236" name="Enable scrolling beyond last line"/>
<Item id="6239" name="Keep selection when right-click outside of selection"/>
<Item id="6245" name="Enable virtual space"/>
</Scintillas>
<DarkMode title="Dark Mode">

@ -341,6 +341,7 @@
<Item id = "6212" name = "Xeito liñal"/>
<Item id = "6213" name = "Xeito de fondo"/>
<Item id = "6214" name = "Realzar a liña activa"/>
<Item id = "6245" name = "Activa espazo virtual"/>
</Scintillas>
<NewDoc title = "Documento novo">
<Item id = "6401" name = "Formato"/>

@ -844,6 +844,7 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="6215" name="Suavizar la fuente"/>
<Item id="6236" name="Permitir desplazamiento tras la próxima línea"/>
<Item id="6239" name="Mantener la selección al hacer clic con el botón derecho fuera de la selección"/>
<Item id="6245" name="Activar espacio virtual"/>
</Scintillas>
<DarkMode title="Modo oscuro">
<Item id="7101" name="Activar modo oscuro"/>

@ -319,8 +319,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
_subEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true);
// Turn virtual space on
_mainEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION);
_subEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION);
int virtualSpaceOptions = SCVS_RECTANGULARSELECTION;
if(svp._virtualSpace)
virtualSpaceOptions |= SCVS_USERACCESSIBLE | SCVS_NOWRAPLINESTART;
_mainEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions);
_subEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions);
// Turn multi-paste on
_mainEditView.execute(SCI_SETMULTIPASTE, SC_MULTIPASTE_EACH);

@ -1571,6 +1571,20 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case NPPM_INTERNAL_VIRTUALSPACE:
{
const bool virtualSpace = (nppParam.getSVP())._virtualSpace;
int virtualSpaceOptions = SCVS_RECTANGULARSELECTION;
if(virtualSpace)
virtualSpaceOptions |= SCVS_USERACCESSIBLE | SCVS_NOWRAPLINESTART;
_mainEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions);
_subEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions);
return TRUE;
}
case NPPM_INTERNAL_SCROLLBEYONDLASTLINE:
{
const bool endAtLastLine = !(nppParam.getSVP())._scrollBeyondLastLine;

@ -5674,6 +5674,16 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
_svp._currentLineHilitingShow = false;
}
// Virtual Space
nm = element->Attribute(TEXT("virtualSpace"));
if (nm)
{
if (!lstrcmp(nm, TEXT("yes")))
_svp._virtualSpace = true;
else if (!lstrcmp(nm, TEXT("no")))
_svp._virtualSpace = false;
}
// Scrolling Beyond Last Line State
nm = element->Attribute(TEXT("scrollBeyondLastLine"));
if (nm)
@ -6051,6 +6061,7 @@ bool NppParameters::writeScintillaParams()
(scintNode->ToElement())->SetAttribute(TEXT("lineWrapMethod"), pWrapMethodStr);
(scintNode->ToElement())->SetAttribute(TEXT("currentLineHilitingShow"), _svp._currentLineHilitingShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("virtualSpace"), _svp._virtualSpace?TEXT("yes"):TEXT("no"));
(scintNode->ToElement())->SetAttribute(TEXT("scrollBeyondLastLine"), _svp._scrollBeyondLastLine?TEXT("yes"):TEXT("no"));
(scintNode->ToElement())->SetAttribute(TEXT("rightClickKeepsSelection"), _svp._rightClickKeepsSelection ? TEXT("yes") : TEXT("no"));
(scintNode->ToElement())->SetAttribute(TEXT("disableAdvancedScrolling"), _svp._disableAdvancedScrolling?TEXT("yes"):TEXT("no"));

@ -885,6 +885,7 @@ struct ScintillaViewParams
bool _whiteSpaceShow = false;
bool _eolShow = false;
int _borderWidth = 2;
bool _virtualSpace = false;
bool _scrollBeyondLastLine = true;
bool _rightClickKeepsSelection = false;
bool _disableAdvancedScrolling = false;

@ -87,9 +87,10 @@ BEGIN
CONTROL "Enable Multi-Editing (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,90,270,10
CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,103,270,10
CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,116,250,10
CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,129,270,10
CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,142,270,10
CONTROL "Disable advanced scrolling feature due to touchpad issue",IDC_CHECK_DISABLEADVANCEDSCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,155,270,10
CONTROL "Enable virtual space",IDC_CHECK_VIRTUALSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,129,270,10
CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,142,270,10
CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,155,270,10
CONTROL "Disable advanced scrolling feature due to touchpad issue",IDC_CHECK_DISABLEADVANCEDSCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,168,270,10
END
IDD_PREFERENCE_SUB_DARKMODE DIALOGEX 0, 0, 455, 185

@ -700,6 +700,7 @@ void EditingSubDlg::initScintParam()
::SendDlgItemMessage(_hSelf, IDC_CHECK_SMOOTHFONT, BM_SETCHECK, svp._doSmoothFont, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_SETCHECK, svp._currentLineHilitingShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_VIRTUALSPACE, BM_SETCHECK, svp._virtualSpace, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SCROLLBEYONDLASTLINE, BM_SETCHECK, svp._scrollBeyondLastLine, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_RIGHTCLICKKEEPSSELECTION, BM_SETCHECK, svp._rightClickKeepsSelection, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DISABLEADVANCEDSCROLL, BM_SETCHECK, svp._disableAdvancedScrolling, 0);
@ -811,6 +812,11 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, 0);
return TRUE;
case IDC_CHECK_VIRTUALSPACE:
svp._virtualSpace = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_VIRTUALSPACE, BM_GETCHECK, 0, 0));
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_VIRTUALSPACE, 0, 0);
return TRUE;
case IDC_CHECK_SCROLLBEYONDLASTLINE:
svp._scrollBeyondLastLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_SCROLLBEYONDLASTLINE, BM_GETCHECK, 0, 0));
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SCROLLBEYONDLASTLINE, 0, 0);

@ -134,6 +134,8 @@
#define IDC_PADDINGRIGHTVAL_STATIC (IDD_PREFERENCE_SUB_EDITING + 43)
#define IDC_DISTRACTIONFREEVAL_STATIC (IDD_PREFERENCE_SUB_EDITING + 44)
#define IDC_CHECK_VIRTUALSPACE (IDD_PREFERENCE_SUB_EDITING + 45)
#define IDD_PREFERENCE_SUB_DELIMITER 6250 //(IDD_PREFERENCE_BOX + 250)
#define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_SUB_DELIMITER + 1)
#define IDD_STATIC_OPENDELIMITER (IDD_PREFERENCE_SUB_DELIMITER + 2)

@ -635,6 +635,7 @@
#define NPPM_INTERNAL_REFRESHDARKMODE (NOTEPADPLUS_USER_INTERNAL + 59)
#define NPPM_INTERNAL_SCINTILLAFINDERCOPYPATHS (NOTEPADPLUS_USER_INTERNAL + 60)
#define NPPM_INTERNAL_REFRESHWORKDIR (NOTEPADPLUS_USER_INTERNAL + 61)
#define NPPM_INTERNAL_VIRTUALSPACE (NOTEPADPLUS_USER_INTERNAL + 62)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)

Loading…
Cancel
Save