From dfae4bae73e160fe8be065648f70d01e0da5c9e9 Mon Sep 17 00:00:00 2001 From: Ekopalypse <47723516+Ekopalypse@users.noreply.github.com> Date: Thu, 26 Dec 2024 09:30:14 +0100 Subject: [PATCH] Some new notepad messages added (#361) * add setUntitledName method * add getTabColorID method * add getNativeLangFileName method * docu updates and fixes * add get- and setLineNumberWidthMode methods * add get-, setExternalLexerAutoIndentMode and isAutoIndention methods * docu updates * MENUCOMMAND enum related cleanups and docu updates * fixes and new tests * make FontStyle tests more robust and cleanups * Skip ansi related test with PythonScript3 version * docu update about correct rereplace usage --- PythonScript/python_tests/RunTests.py | 69 +++-- .../tests/test_NotepadWrapperTestCase.py | 152 +++++++-- .../tests/test_ReplaceAnsiPythonFunction.py | 20 +- .../tests/test_ReplaceAnsiTestCase.py | 19 +- .../tests/test_ScintillaWrapperTestCase.py | 89 +++--- PythonScript/src/NotepadPlusWrapper.cpp | 49 +++ PythonScript/src/NotepadPlusWrapper.h | 48 ++- PythonScript/src/NotepadPython.cpp | 44 ++- docs/source/enums.rst | 290 ++++++++++++++++-- docs/source/notepad.rst | 53 +++- docs/source/scintilla.rst | 6 +- 11 files changed, 675 insertions(+), 164 deletions(-) diff --git a/PythonScript/python_tests/RunTests.py b/PythonScript/python_tests/RunTests.py index 8b81c196..73c5e7fb 100644 --- a/PythonScript/python_tests/RunTests.py +++ b/PythonScript/python_tests/RunTests.py @@ -2,45 +2,62 @@ import sys import unittest import os +from Npp import console, notepad, MESSAGEBOXFLAGS -# unittest module expects argv to be set -sys.argv = [''] +def main(): -(path, runTestsName) = os.path.split(__file__) + # A debug build influences the test runs due to the assertions and print outputs. + if notepad.messageBox( + "Make sure you have a release build of the PythonScript plugin if you want to run the test suite.\n\nShould the test suite be started?", + "Run Tests?", + MESSAGEBOXFLAGS.ICONQUESTION | MESSAGEBOXFLAGS.YESNO + ) == MESSAGEBOXFLAGS.RESULTNO: + return -test_suites = [] + # unittest module expects argv to be set + sys.argv = [''] -results = unittest.TestResult() -loader = unittest.TestLoader() -test_suites = loader.discover(os.path.join(path, 'tests')) + (path, runTestsName) = os.path.split(__file__) -alltests = unittest.TestSuite(test_suites) + test_suites = [] -console.show() -console.clear() + results = unittest.TestResult() + loader = unittest.TestLoader() + test_suites = loader.discover(os.path.join(path, 'tests')) -alltests.run(results) + alltests = unittest.TestSuite(test_suites) -# console.write('Tests Run: {} Errors: {} Failures: {}'.format(results.testRun, results.errors, results.failures)) + console.clear() -def writeTestFailure(error): - console.write('TEST: %s\n' % error[0]) - console.writeError(error[1]) - console.write('\n----------------------------\n') -if results.errors: - for error in results.errors: - writeTestFailure(error) + alltests.run(results) -if results.failures: - for error in results.failures: - writeTestFailure(error) + # console.write('Tests Run: {} Errors: {} Failures: {}'.format(results.testRun, results.errors, results.failures)) + + def writeTestFailure(error): + console.write('TEST: %s\n' % error[0]) + console.writeError(error[1]) + console.write('\n----------------------------\n') + + if results.errors: + for error in results.errors: + writeTestFailure(error) + + if results.failures: + for error in results.failures: + writeTestFailure(error) + + if results.errors or results.failures: + console.writeError('Tests Run: {} Errors: {} Failures: {}\n'.format(results.testsRun, len(results.errors), len(results.failures))) + else: + console.write('Tests Run: {} Errors: {} Failures: {}\n'.format(results.testsRun, len(results.errors), len(results.failures))) -if results.errors or results.failures: - console.writeError('Tests Run: {} Errors: {} Failures: {}\n'.format(results.testsRun, len(results.errors), len(results.failures))) -else: - console.write('Tests Run: {} Errors: {} Failures: {}\n'.format(results.testsRun, len(results.errors), len(results.failures))) if results.skipped: console.write('Skipped: {}\n'.format(len(results.skipped))) for skipped_test in results.skipped: console.write(' {} - {}\n'.format(skipped_test[0], skipped_test[1])) + + console.show() + + +main() diff --git a/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py b/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py index 05b7ab5e..8cd183b8 100644 --- a/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py +++ b/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py @@ -10,7 +10,7 @@ from threading import Timer import subprocess -from Npp import notepad, editor, console, WINVER, LANGTYPE, MENUCOMMAND, BUFFERENCODING +from Npp import notepad, editor, console, WINVER, LANGTYPE, MENUCOMMAND, BUFFERENCODING, LINENUMWIDTHMODE EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, @@ -69,14 +69,11 @@ def _get_active_styler_xml(self): darkmode_enabled = xml_doc.find('GUIConfigs/GUIConfig[@name="DarkMode"]').get('enable') darkThemeName = xml_doc.find('GUIConfigs/GUIConfig[@name="DarkMode"]').get('darkThemeName') lightThemeName = xml_doc.find('GUIConfigs/GUIConfig[@name="DarkMode"]').get('lightThemeName') - print(darkmode_enabled) - themepath = os.path.join(self._get_config_directory(), r'stylers.xml') + themepath = os.path.join(self._get_config_directory(), r'stylers.xml') if(darkmode_enabled != 'no'): - print(darkThemeName) - themepath = os.path.join(self._get_config_directory(), r'themes', darkThemeName) + themepath = os.path.join(self._get_config_directory(), r'themes', darkThemeName) elif(lightThemeName != ''): - print(lightThemeName) - themepath = os.path.join(self._get_config_directory(), r'themes', lightThemeName) + themepath = os.path.join(self._get_config_directory(), r'themes', lightThemeName) return themepath @@ -447,7 +444,7 @@ def store_silent_updates(hwnd, lParam): f.close() beforeReload = editor.getText() # TODO: See https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12418 - self.assertFalse(notepad.reloadFile(filename, False)) + self.assertTrue(notepad.reloadFile(filename, False)) afterReload = editor.getText() notepad.close() @@ -455,18 +452,20 @@ def store_silent_updates(hwnd, lParam): self.assertEqual(afterReload, 'Updated outside') def test_getPluginConfigDir(self): - dir = notepad.getPluginConfigDir() - self.assertTrue(dir.lower().endswith('plugins\\config')) + cur_dir = notepad.getPluginConfigDir() + self.assertTrue(cur_dir.lower().endswith('plugins\\config')) def test_nppCommandLineDir(self): - dir = notepad.getNppDir() + cur_dir = notepad.getNppDir() commandLine = notepad.getCommandLine() - nppExe = shlex.split(commandLine)[0] + nppExe = shlex.split(commandLine, posix=False)[0] nppDirOfExe = os.path.dirname(nppExe) - - self.assertEqual(dir, nppDirOfExe) + if nppDirOfExe: + self.assertEqual(cur_dir, nppDirOfExe, msg="Expected same value, got: {} vs. {}".format(cur_dir, nppDirOfExe)) + else: + self.assertTrue(len(commandLine) != 0) # new tests @@ -1501,7 +1500,8 @@ def start_monitor(): menu_handle = ctypes.windll.user32.SendMessageW(tabbar_context_menu_hwnd, MN_GETHMENU, 0, 0) item_count = ctypes.windll.user32.GetMenuItemCount(menu_handle) - self.assertEqual(item_count, 16, msg=u'Expected 16 menu items but received:{}'.format(item_count)) + # TODO: a hard-coded value is quite bad + self.assertEqual(item_count, 17, msg=u'Expected 17 menu items but received:{}'.format(item_count)) ctypes.windll.user32.SendMessageW(tabbar_context_menu_hwnd, WM_CLOSE, 0, 0) timer = Timer(1, start_monitor) @@ -1515,14 +1515,123 @@ def test_getPluginHomePath(self): _, _, plugin_dir = notepad.getPluginHomePath().rpartition('\\') self.assertTrue('plugins' == plugin_dir) + def test_getSettingsOnCloudPath(self): ''' Check if cloud path last part has default empty ''' self.__test_invalid_parameter_passed(notepad.getSettingsOnCloudPath) _, _, cloud_dir = notepad.getSettingsOnCloudPath().rpartition('\\') self.assertTrue('' == cloud_dir) + + def test_setUntitledName(self): + ''' ''' + notepad_method = notepad.setUntitledName + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, None,None) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, None,None,None) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, -1) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, -1,-1,-1) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, '','') + + + def test_getTabColorID(self): + ''' ''' + notepad_method = notepad.getTabColorID + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, None) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, None,None) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, None,None,None) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, -1,-1,-1) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, '','') + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, '42','42') + + # first get the configured colors + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_NONE) + tab_colour_none = notepad.getTabColorID() + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_1) + tab_color_1 = notepad.getTabColorID() + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_2) + tab_color_2 = notepad.getTabColorID() + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_3) + tab_color_3 = notepad.getTabColorID() + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_4) + tab_color_4 = notepad.getTabColorID() + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_5) + tab_color_5 = notepad.getTabColorID() + + # test + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_NONE) + self.assertTrue(tab_colour_none == notepad.getTabColorID()) + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_1) + self.assertTrue(tab_color_1== notepad.getTabColorID()) + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_2) + self.assertTrue(tab_color_2== notepad.getTabColorID()) + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_3) + self.assertTrue(tab_color_3== notepad.getTabColorID()) + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_4) + self.assertTrue(tab_color_4== notepad.getTabColorID()) + notepad.menuCommand(MENUCOMMAND.VIEW_TAB_COLOUR_5) + self.assertTrue(tab_color_5== notepad.getTabColorID()) + + + def test_getNativeLangFileName(self): + ''' ''' + self.__test_invalid_parameter_passed(notepad.getNativeLangFileName) + + + def test_lineNumberWidthMode(self): + ''' ''' + self.__test_invalid_parameter_passed(notepad.getLineNumberWidthMode) + self.__test_invalid_parameter_passed(notepad.setLineNumberWidthMode) + + mode = notepad.getLineNumberWidthMode() + if notepad.setLineNumberWidthMode(LINENUMWIDTHMODE.CONSTANT if mode == LINENUMWIDTHMODE.DYNAMIC else LINENUMWIDTHMODE.DYNAMIC): + changed_mode = notepad.getLineNumberWidthMode() + self.assertTrue(changed_mode != mode, msg="Expected different modes, got {} and {}".format(mode, changed_mode)) + if notepad.setLineNumberWidthMode(LINENUMWIDTHMODE.CONSTANT if mode == LINENUMWIDTHMODE.CONSTANT else LINENUMWIDTHMODE.DYNAMIC): + revert_changed_mode = notepad.getLineNumberWidthMode() + self.assertTrue(revert_changed_mode == mode, msg="Expected same modes, got {} and {}".format(mode, changed_mode)) + + # TODO: How can this be tested in a meaningful way? + def test_getExternalLexerAutoIndentMode(self): + ''' ''' + notepad_method = notepad.getExternalLexerAutoIndentMode + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, None,None) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, None,None,None) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, -1) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, -1,-1,-1) + with self.assertRaises(ArgumentError): + self._invalid_parameter_passed(notepad_method, '','') + + # TODO: How can this be tested in a meaningful way? + def test_setExternalLexerAutoIndentMode(self): + ''' ''' + self.__test_invalid_parameter_passed(notepad.setExternalLexerAutoIndentMode) + + # TODO: How can this be tested in a meaningful way? + def test_isAutoIndention(self): + ''' ''' + self.__test_invalid_parameter_passed(notepad.isAutoIndention) + + +suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase) + if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase) alltests = unittest.TestSuite(suite) results = unittest.TestResult() @@ -1545,10 +1654,7 @@ def writeTestFailure(error): console.writeError('Tests Run: {}\n Errors : {}\n Failures: {}\n'.format(results.testsRun, len(results.errors), len(results.failures))) else: console.write('Tests Run: {}\n Errors : {}\n Failures: {}\n'.format(results.testsRun, len(results.errors), len(results.failures))) - if results.skipped: - console.write('Skipped: {}\n'.format(len(results.skipped))) - for skipped_test in results.skipped: - console.write(' {} - {}\n'.format(skipped_test[0], skipped_test[1])) - console.show() -else: - suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase) \ No newline at end of file + if results.skipped: + console.write('Skipped: {}\n'.format(len(results.skipped))) + for skipped_test in results.skipped: + console.write(' {} - {}\n'.format(skipped_test[0], skipped_test[1])) diff --git a/PythonScript/python_tests/tests/test_ReplaceAnsiPythonFunction.py b/PythonScript/python_tests/tests/test_ReplaceAnsiPythonFunction.py index fddf7b9a..b2f48970 100644 --- a/PythonScript/python_tests/tests/test_ReplaceAnsiPythonFunction.py +++ b/PythonScript/python_tests/tests/test_ReplaceAnsiPythonFunction.py @@ -33,13 +33,15 @@ def tearDown(self): editor.setSavePoint() notepad.close() + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_replace_function(self): editor.rereplace(r'([a-z]+)([0-9]+)'.encode('windows-1252'), group2_with_counter) text = editor.getText() self.assertEqual(text, u'1231 54322 983\r\nä1234 ü54325 ö986\r\n'.encode('windows-1252')) + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_unicode_replace_function(self): - editor.rereplace(ur'([a-zäöü]+)([0-9]+)', group1_with_counter) + editor.rereplace(r'([a-zäöü]+)([0-9]+)', group1_with_counter) text = editor.getText() self.assertEqual(text, u'abc1 def2 gh3\r\näbc4 üef5 öh6\r\n'.encode('windows-1252')) @@ -55,24 +57,27 @@ def groups_check(self, m): self.assertEqual(m.groups(), groups_data_correct[counter]) return counter + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_groups(self): - editor.rereplace(ur'([a-zäöü]+)([0-9]+)', lambda m: self.groups_check(m)) + editor.rereplace(r'([a-zäöü]+)([0-9]+)', lambda m: self.groups_check(m)) text = editor.getText() self.assertEqual(text, '1 2 3\r\n4 5 6\r\n') - + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_groups_with_named_groups(self): - editor.rereplace(ur'(?[a-zäöü]+)(?[0-9]+)', lambda m: self.groups_check(m)) + editor.rereplace(r'(?[a-zäöü]+)(?[0-9]+)', lambda m: self.groups_check(m)) text = editor.getText() self.assertEqual(text, '1 2 3\r\n4 5 6\r\n') + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_named_groups(self): - editor.rereplace(ur'(?[a-zäöü]+)(?[0-9]+)', lambda m: m.group('letters')) + editor.rereplace(r'(?[a-zäöü]+)(?[0-9]+)', lambda m: m.group('letters')) text = editor.getText() self.assertEqual(text, u'abc def gh\r\näbc üef öh\r\n'.encode('windows-1252')) + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_named_groups_2(self): - editor.rereplace(ur'(?[a-zäöü]+)(?[0-9]+)', lambda m: m.group('numbers')) + editor.rereplace(r'(?[a-zäöü]+)(?[0-9]+)', lambda m: m.group('numbers')) text = editor.getText() self.assertEqual(text, '123 5432 98\r\n123 5432 98\r\n') @@ -89,8 +94,9 @@ def group_tuples_check(self, m): self.assertEqual(m.group(2, 'letters', 'numbers'), groups_data_correct[counter]) return counter + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_group_tuples(self): - editor.rereplace(ur'(?[a-zäöü]+)(?[0-9]+)', lambda m: self.group_tuples_check(m)) + editor.rereplace(r'(?[a-zäöü]+)(?[0-9]+)', lambda m: self.group_tuples_check(m)) text = editor.getText() self.assertEqual(text, '1 2 3\r\n4 5 6\r\n') diff --git a/PythonScript/python_tests/tests/test_ReplaceAnsiTestCase.py b/PythonScript/python_tests/tests/test_ReplaceAnsiTestCase.py index 6f95aa31..0b310b1f 100644 --- a/PythonScript/python_tests/tests/test_ReplaceAnsiTestCase.py +++ b/PythonScript/python_tests/tests/test_ReplaceAnsiTestCase.py @@ -6,27 +6,32 @@ class ReplaceAnsiTestCase(unittest.TestCase): def setUp(self): notepad.new() notepad.runMenuCommand("Encoding", "Convert to ANSI") - editor.write(u'Here is some text\r\nWith some umlauts XäXüXö\r\n'.encode('windows-1252')); + editor.write(u'Here is some text\r\nWith some umlauts XäXüXö\r\n'.encode('windows-1252')) + def tearDown(self): editor.setSavePoint() notepad.close() + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_simple_replace(self): - editor.rereplace(r'some\s([a-z]+)', 'TEST'); + editor.rereplace(r'some\s([a-z]+)', 'TEST') text = editor.getText() - self.assertEqual(text, u'Here is TEST\r\nWith TEST XäXüXö\r\n'.encode('windows-1252')); + self.assertEqual(text, u'Here is TEST\r\nWith TEST XäXüXö\r\n'.encode('windows-1252')) + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_ansi_replace(self): - editor.rereplace(u'X[äö]'.encode('windows-1252'), 'YY'); + editor.rereplace(u'X[äö]'.encode('windows-1252'), 'YY') text = editor.getText() - self.assertEqual(text, u'Here is some text\r\nWith some umlauts YYXüYY\r\n'.encode('windows-1252')); + self.assertEqual(text, u'Here is some text\r\nWith some umlauts YYXüYY\r\n'.encode('windows-1252')) + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_unicode_replace(self): - editor.rereplace(u'X[äö]', 'PP'); + editor.rereplace(u'X[äö]', 'PP') text = editor.getText() - self.assertEqual(text, u'Here is some text\r\nWith some umlauts PPXüPP\r\n'.encode('windows-1252')); + self.assertEqual(text, u'Here is some text\r\nWith some umlauts PPXüPP\r\n'.encode('windows-1252')) + @unittest.skipIf(notepad.getPluginVersion()[0] == '3', "not yet py3-compatible") def test_replace_with_unicode(self): editor.rereplace('Here|With', u'XäöüY') text = editor.getText() diff --git a/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py b/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py index f5ac6f74..e64c1d01 100644 --- a/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py +++ b/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py @@ -72,7 +72,7 @@ def callback_scintillawrapper_int_int_string(self, args): def test_scintillawrapper_int_int_string_in_callback(self): editor.write('ABC This is a some ABC text we are going to search') editor.callback(lambda args: self.callback_scintillawrapper_int_int_string(args), [SCINTILLANOTIFICATION.SAVEPOINTREACHED]) - editor.setSavePoint(); + editor.setSavePoint() self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -106,14 +106,14 @@ def test_scintillawrapper_void_void_int(self): docPointer = editor.getDocPointer() notepad.outputDebugString('creating hidden scintilla\n') hiddenScintilla = notepad.createScintilla() - notepad.outputDebugString('setting doc pointer in hidden scintilla\n'); + notepad.outputDebugString('setting doc pointer in hidden scintilla\n') hiddenScintilla.setDocPointer(docPointer) - notepad.outputDebugString('complete - set doc pointer in hidden scintilla\n'); + notepad.outputDebugString('complete - set doc pointer in hidden scintilla\n') hiddenScintilla.write('hello world, from the other side') text = editor.getText() - notepad.outputDebugString('about to destroy scintilla\n'); + notepad.outputDebugString('about to destroy scintilla\n') notepad.destroyScintilla(hiddenScintilla) - notepad.outputDebugString('destroyed scintilla\n'); + notepad.outputDebugString('destroyed scintilla\n') self.assertEqual(text, 'hello world, from the other side') def callback_scintillawrapper_void_void_int(self, args): @@ -124,7 +124,7 @@ def callback_scintillawrapper_void_void_int(self, args): def test_scintillawrapper_void_void_int_in_callback(self): notepad.outputDebugString('test_scintillawrapper_void_void_int_in_callback') - editor.write('test'); + editor.write('test') editor.callback(lambda args: self.callback_scintillawrapper_void_void_int(args), [SCINTILLANOTIFICATION.SAVEPOINTREACHED]) editor.setSavePoint() self.poll_for_callback() @@ -275,7 +275,7 @@ def callback_scintillawrapper_int_string_stringresult(self, args): def test_scintillawrapper_int_string_stringresult_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_int_string_stringresult(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -294,7 +294,7 @@ def callback_scintillawrapper_int_position_bool(self, args): def test_scintillawrapper_int_position_bool_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_int_position_bool(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -324,7 +324,7 @@ def callback_scintillawrapper_void_bool_void(self, args): def test_scintillawrapper_void_bool_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_bool_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -347,8 +347,11 @@ def callback_scintillawrapper_void_int_string(self, args): def test_scintillawrapper_void_int_string_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_int_string(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + original_mask = editor.getModEventMask() + editor.setModEventMask(MODIFICATIONFLAGS.INSERTTEXT) + editor.write("test") self.poll_for_callback() + editor.setModEventMask(original_mask) self.assertEqual(self.callbackCalled, True) def test_scintillawrapper_int_void_void(self): @@ -363,7 +366,7 @@ def callback_scintillawrapper_int_void_void(self, args): def test_scintillawrapper_int_void_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_int_void_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("12345"); + editor.write("12345") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -384,7 +387,7 @@ def callback_scintillawrapper_void_position_int(self, args): def test_scintillawrapper_void_position_int_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_position_int(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -399,12 +402,12 @@ def callback_scintillawrapper_int_string_void(self, args): def test_scintillawrapper_int_string_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_int_string_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) def test_scintillawrapper_position_int_int(self): - editor.write('Hello World'); + editor.write('Hello World') x = editor.pointXFromPosition(6) # X position of the W y = editor.pointYFromPosition(6) @@ -439,7 +442,7 @@ def callback_scintillawrapper_colour_void_void(self, args): def test_scintillawrapper_colour_void_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_colour_void_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -460,7 +463,7 @@ def callback_scintillawrapper_bool_void_void(self, args): def test_scintillawrapper_bool_void_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_bool_void_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -494,7 +497,7 @@ def callback_scintillawrapper_int_position_void(self, args): def test_scintillawrapper_int_position_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_int_position_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") # self.poll_for_callback() self.poll_for_callback() @@ -511,7 +514,7 @@ def callback_scintillawrapper_void_string_string(self, args): def test_scintillawrapper_void_string_string_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_string_string(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -530,7 +533,7 @@ def callback_scintillawrapper_void_position_position(self, args): def test_scintillawrapper_void_position_position_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_position_position(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -545,7 +548,7 @@ def callback_scintillawrapper_void_bool_colour(self, args): def test_scintillawrapper_void_bool_colour_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_bool_colour(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -582,7 +585,7 @@ def callback_scintillawrapper_void_keymod_void(self, args): def test_scintillawrapper_void_keymod_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_keymod_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -603,7 +606,7 @@ def callback_scintillawrapper_void_void_void(self, args): def test_scintillawrapper_void_void_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_void_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -634,11 +637,13 @@ def callback_scintillawrapper_int_int_stringresult_styleGetFont(self, args): def test_scintillawrapper_int_int_stringresult_in_callback_styleGetFont(self): editor.callback(lambda args: self.callback_scintillawrapper_int_int_stringresult_styleGetFont(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + original_mask = editor.getModEventMask() + editor.setModEventMask(MODIFICATIONFLAGS.INSERTTEXT) + editor.write("test") self.poll_for_callback() + editor.setModEventMask(original_mask) self.assertEqual(self.callbackCalled, True) - def callback_scintillawrapper_int_int_stringresult_getLine(self, args): lineTwo = editor.getLine(1) lineThree = editor.getLine(2) @@ -648,7 +653,7 @@ def callback_scintillawrapper_int_int_stringresult_getLine(self, args): def test_scintillawrapper_int_int_stringresult_in_callback_getLine(self): editor.callback(lambda args: self.callback_scintillawrapper_int_int_stringresult_getLine(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("One\r\nTwo\r\nThree"); + editor.write("One\r\nTwo\r\nThree") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -660,7 +665,7 @@ def callback_scintillawrapper_int_int_stringresult_getCurLine(self, args): def test_scintillawrapper_int_int_stringresult_in_callback_getCurLine(self): editor.callback(lambda args: self.callback_scintillawrapper_int_int_stringresult_getLine(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("One\r\nTwo\r\nThree"); + editor.write("One\r\nTwo\r\nThree") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -679,7 +684,7 @@ def callback_scintillawrapper_void_colour_void(self, args): def test_scintillawrapper_void_colour_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_colour_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -700,7 +705,7 @@ def callback_scintillawrapper_void_int_bool(self, args): def test_scintillawrapper_void_int_bool_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_int_bool(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -729,7 +734,7 @@ def callback_scintillawrapper_int_int_void(self, args): def test_scintillawrapper_int_int_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_int_int_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -750,7 +755,7 @@ def callback_scintillawrapper_void_position_void(self, args): def test_scintillawrapper_void_position_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_position_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -799,7 +804,7 @@ def callback_scintillawrapper_colour_int_void(self, args): def test_scintillawrapper_colour_int_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_colour_int_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -818,7 +823,7 @@ def callback_scintillawrapper_bool_int_void(self, args): def test_scintillawrapper_bool_int_void_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_bool_int_void(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -835,7 +840,7 @@ def callback_scintillawrapper_void_void_string_lexerLanguage(self, args): def test_scintillawrapper_void_void_string_in_callback_lexerLanguage(self): editor.callback(lambda args: self.callback_scintillawrapper_void_void_string_lexerLanguage(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -855,7 +860,7 @@ def callback_scintillawrapper_void_void_string(self, args): def test_scintillawrapper_void_void_string_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_void_string(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -883,7 +888,7 @@ def test_scintillawrapper_int_void_position(self): # This test is actually identical to position_int_int # That test is for positionFromPoint(), this is for pointXFromPosition() # I'm leaving this in, so we've definitely got a covering test for int_void_position - editor.write('Hello World'); + editor.write('Hello World') x = editor.pointXFromPosition(6) # X position of the W y = editor.pointYFromPosition(6) position = editor.positionFromPoint(x, y) @@ -925,7 +930,7 @@ def callback_scintillawrapper_void_int_position(self, args): def test_scintillawrapper_void_int_position_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_int_position(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -951,7 +956,7 @@ def callback_scintillawrapper_void_int_int(self, args): def test_scintillawrapper_void_int_int_in_callback(self): editor.callback(lambda args: self.callback_scintillawrapper_void_int_int(args), [SCINTILLANOTIFICATION.MODIFIED]) - editor.write("test"); + editor.write("test") self.poll_for_callback() self.assertEqual(self.callbackCalled, True) @@ -984,31 +989,31 @@ def test_getCharacterPointer(self): def test_deleteLine_with_contents(self): editor.write('Line 1\r\nLine 2\r\nLine 3\r\n') editor.deleteLine(1) - text = editor.getText(); + text = editor.getText() self.assertEqual(text, 'Line 1\r\nLine 3\r\n') def test_deleteLine_middle_no_contents(self): editor.write('Line 1\r\n\r\nLine 3\r\n') editor.deleteLine(1) - text = editor.getText(); + text = editor.getText() self.assertEqual(text, 'Line 1\r\nLine 3\r\n') def test_deleteLine_end_no_contents(self): editor.write('Line 1\r\nLine 2\r\n\r\n') editor.deleteLine(2) - text = editor.getText(); + text = editor.getText() self.assertEqual(text, 'Line 1\r\nLine 2\r\n') def test_deleteLine_end_no_eol(self): editor.write('Line 1\r\nLine 2\r\nLine 3') editor.deleteLine(2) - text = editor.getText(); + text = editor.getText() self.assertEqual(text, 'Line 1\r\nLine 2\r\n') def test_deleteLine_start_no_contents(self): editor.write('\r\nLine 2\r\nLine 3\r\n') editor.deleteLine(0) - text = editor.getText(); + text = editor.getText() self.assertEqual(text, 'Line 2\r\nLine 3\r\n') diff --git a/PythonScript/src/NotepadPlusWrapper.cpp b/PythonScript/src/NotepadPlusWrapper.cpp index 750fea04..59d2b712 100644 --- a/PythonScript/src/NotepadPlusWrapper.cpp +++ b/PythonScript/src/NotepadPlusWrapper.cpp @@ -1068,6 +1068,55 @@ void NotepadPlusWrapper::disableAutoUpdate() callNotepad(NPPM_DISABLEAUTOUPDATE); } +bool NotepadPlusWrapper::setUntitledName(const char *newName, intptr_t bufferID = 0) +{ + if ( !newName) { return false; } + return static_cast(callNotepad(NPPM_SETUNTITLEDNAME, bufferID, reinterpret_cast(WcharMbcsConverter::char2tchar(newName).get()))); +} + +int NotepadPlusWrapper::getTabColorID(int view, int tabIndex) +{ + return static_cast(callNotepad(NPPM_GETTABCOLORID, view, tabIndex)); +} + +boost::python::str NotepadPlusWrapper::getNativeLangFileName() +{ + size_t size = callNotepad(NPPM_GETNATIVELANGFILENAME) + 1; + std::vector buffer(size); + callNotepad(NPPM_GETNATIVELANGFILENAME, size, reinterpret_cast(buffer.data())); + return boost::python::str(buffer.data(), size - 1); +} + +LineNumWidthMode NotepadPlusWrapper::getLineNumberWidthMode() { + return static_cast(callNotepad(NPPM_GETLINENUMBERWIDTHMODE)); +} + +bool NotepadPlusWrapper::setLineNumberWidthMode(LineNumWidthMode widthMode) { + return static_cast(callNotepad(NPPM_SETLINENUMBERWIDTHMODE, 0, static_cast(widthMode))); +} + +boost::python::object NotepadPlusWrapper::getExternalLexerAutoIndentMode(const char* externalLexerName) { + int indentMode = -1; + bool result = static_cast(callNotepad(NPPM_GETEXTERNALLEXERAUTOINDENTMODE, reinterpret_cast(WcharMbcsConverter::char2tchar(externalLexerName).get()), reinterpret_cast(&indentMode))); + if (result) + { + return boost::python::object(static_cast(indentMode)); + } + else + { + return boost::python::object(); + } +} + +bool NotepadPlusWrapper::setExternalLexerAutoIndentMode(const char* externalLexerName, AutoIndentMode indentMode) { + + return static_cast(callNotepad(NPPM_SETEXTERNALLEXERAUTOINDENTMODE, reinterpret_cast(WcharMbcsConverter::char2tchar(externalLexerName).get()), static_cast(indentMode))); +} + +bool NotepadPlusWrapper::isAutoIndention() { + return static_cast(callNotepad(NPPM_ISAUTOINDENTON)); +} + bool NotepadPlusWrapper::isSingleView() const { HWND splitter_hwnd = FindWindowEx(m_nppHandle, NULL, L"splitterContainer", NULL); diff --git a/PythonScript/src/NotepadPlusWrapper.h b/PythonScript/src/NotepadPlusWrapper.h index 3fd713cf..6aad76ae 100644 --- a/PythonScript/src/NotepadPlusWrapper.h +++ b/PythonScript/src/NotepadPlusWrapper.h @@ -122,7 +122,6 @@ enum MessageBoxFlags enum MenuCommands { - NPPIDM_FILE = IDM_FILE, NPPIDM_FILE_NEW = IDM_FILE_NEW, NPPIDM_FILE_OPEN = IDM_FILE_OPEN, NPPIDM_FILE_CLOSE = IDM_FILE_CLOSE, @@ -149,9 +148,8 @@ enum MenuCommands NPPIDM_FILE_OPEN_DEFAULT_VIEWER = IDM_FILE_OPEN_DEFAULT_VIEWER, NPPIDM_FILE_CLOSEALL_UNCHANGED = IDM_FILE_CLOSEALL_UNCHANGED, NPPIDM_FILE_CONTAININGFOLDERASWORKSPACE = IDM_FILE_CONTAININGFOLDERASWORKSPACE, - NPPIDM_FILEMENU_LASTONE = IDM_FILEMENU_LASTONE, NPPIDM_FILEMENU_EXISTCMDPOSITION = IDM_FILEMENU_EXISTCMDPOSITION, - NPPIDM_EDIT = IDM_EDIT, + NPPIDM_EDIT_CUT = IDM_EDIT_CUT, NPPIDM_EDIT_COPY = IDM_EDIT_COPY, NPPIDM_EDIT_UNDO = IDM_EDIT_UNDO, @@ -257,7 +255,7 @@ enum MenuCommands NPPIDM_EDIT_AUTOCOMPLETE_PATH = IDM_EDIT_AUTOCOMPLETE_PATH, NPPIDM_EDIT_FUNCCALLTIP_PREVIOUS = IDM_EDIT_FUNCCALLTIP_PREVIOUS, NPPIDM_EDIT_FUNCCALLTIP_NEXT = IDM_EDIT_FUNCCALLTIP_NEXT, - NPPIDM_SEARCH = IDM_SEARCH, + NPPIDM_SEARCH_FIND = IDM_SEARCH_FIND, NPPIDM_SEARCH_FINDNEXT = IDM_SEARCH_FINDNEXT, NPPIDM_SEARCH_REPLACE = IDM_SEARCH_REPLACE, @@ -324,12 +322,12 @@ enum MenuCommands NPPIDM_SEARCH_CHANGED_NEXT = IDM_SEARCH_CHANGED_NEXT, NPPIDM_SEARCH_CHANGED_PREV = IDM_SEARCH_CHANGED_PREV, NPPIDM_SEARCH_CLEAR_CHANGE_HISTORY = IDM_SEARCH_CLEAR_CHANGE_HISTORY, - NPPIDM_MISC = IDM_MISC, + NPPIDM_DOCLIST_FILESCLOSE = IDM_DOCLIST_FILESCLOSE, NPPIDM_DOCLIST_FILESCLOSEOTHERS = IDM_DOCLIST_FILESCLOSEOTHERS, NPPIDM_DOCLIST_COPYNAMES = IDM_DOCLIST_COPYNAMES, NPPIDM_DOCLIST_COPYPATHS = IDM_DOCLIST_COPYPATHS, - NPPIDM_VIEW = IDM_VIEW, + NPPIDM_VIEW_TOOLBAR_REDUCE = IDM_VIEW_TOOLBAR_REDUCE, NPPIDM_VIEW_TOOLBAR_ENLARGE = IDM_VIEW_TOOLBAR_ENLARGE, NPPIDM_VIEW_TOOLBAR_STANDARD = IDM_VIEW_TOOLBAR_STANDARD, @@ -443,7 +441,7 @@ enum MenuCommands NPPIDM_VIEW_LOAD_IN_NEW_INSTANCE = IDM_VIEW_LOAD_IN_NEW_INSTANCE, NPPIDM_VIEW_GOTO_START = IDM_VIEW_GOTO_START, NPPIDM_VIEW_GOTO_END = IDM_VIEW_GOTO_END, - NPPIDM_FORMAT = IDM_FORMAT, + NPPIDM_FORMAT_TODOS = IDM_FORMAT_TODOS, NPPIDM_FORMAT_TOUNIX = IDM_FORMAT_TOUNIX, NPPIDM_FORMAT_TOMAC = IDM_FORMAT_TOMAC, @@ -504,8 +502,7 @@ enum MenuCommands NPPIDM_FORMAT_MAC_CYRILLIC = IDM_FORMAT_MAC_CYRILLIC, NPPIDM_FORMAT_KOI8U_CYRILLIC = IDM_FORMAT_KOI8U_CYRILLIC, NPPIDM_FORMAT_KOI8R_CYRILLIC = IDM_FORMAT_KOI8R_CYRILLIC, - NPPIDM_FORMAT_ENCODE_END = IDM_FORMAT_ENCODE_END, - NPPIDM_LANG = IDM_LANG, + NPPIDM_LANGSTYLE_CONFIG_DLG = IDM_LANGSTYLE_CONFIG_DLG, NPPIDM_LANG_C = IDM_LANG_C, NPPIDM_LANG_CPP = IDM_LANG_CPP, @@ -604,6 +601,7 @@ enum MenuCommands NPPIDM_LANG_USER_DLG = IDM_LANG_USER_DLG, NPPIDM_LANG_OPENUDLDIR = IDM_LANG_OPENUDLDIR, NPPIDM_LANG_UDLCOLLECTION_PROJECT_SITE = IDM_LANG_UDLCOLLECTION_PROJECT_SITE, + NPPIDM_ABOUT = IDM_ABOUT, NPPIDM_HOMESWEETHOME = IDM_HOMESWEETHOME, NPPIDM_PROJECTPAGE = IDM_PROJECTPAGE, @@ -614,7 +612,7 @@ enum MenuCommands NPPIDM_CONFUPDATERPROXY = IDM_CONFUPDATERPROXY, NPPIDM_CMDLINEARGUMENTS = IDM_CMDLINEARGUMENTS, NPPIDM_DEBUGINFO = IDM_DEBUGINFO, - NPPIDM_SETTING = IDM_SETTING, + NPPIDM_SETTING_IMPORTPLUGIN = IDM_SETTING_IMPORTPLUGIN, NPPIDM_SETTING_IMPORTSTYLETHEMES = IDM_SETTING_IMPORTSTYLETHEMES, NPPIDM_SETTING_TRAYICON = IDM_SETTING_TRAYICON, @@ -626,7 +624,7 @@ enum MenuCommands NPPIDM_SETTING_SHORTCUT_MAPPER_MACRO = IDM_SETTING_SHORTCUT_MAPPER_MACRO, NPPIDM_SETTING_SHORTCUT_MAPPER_RUN = IDM_SETTING_SHORTCUT_MAPPER_RUN, NPPIDM_SETTING_EDITCONTEXTMENU = IDM_SETTING_EDITCONTEXTMENU, - NPPIDM_TOOL = IDM_TOOL, + NPPIDM_TOOL_MD5_GENERATE = IDM_TOOL_MD5_GENERATE, NPPIDM_TOOL_MD5_GENERATEFROMFILE = IDM_TOOL_MD5_GENERATEFROMFILE, NPPIDM_TOOL_MD5_GENERATEINTOCLIPBOARD = IDM_TOOL_MD5_GENERATEINTOCLIPBOARD, @@ -639,13 +637,15 @@ enum MenuCommands NPPIDM_TOOL_SHA512_GENERATE = IDM_TOOL_SHA512_GENERATE, NPPIDM_TOOL_SHA512_GENERATEFROMFILE = IDM_TOOL_SHA512_GENERATEFROMFILE, NPPIDM_TOOL_SHA512_GENERATEINTOCLIPBOARD = IDM_TOOL_SHA512_GENERATEINTOCLIPBOARD, + NPPIDM_EXECUTE = IDM_EXECUTE, - NPPIDM_SYSTRAYPOPUP = IDM_SYSTRAYPOPUP, + NPPIDM_SYSTRAYPOPUP_ACTIVATE = IDM_SYSTRAYPOPUP_ACTIVATE, NPPIDM_SYSTRAYPOPUP_NEWDOC = IDM_SYSTRAYPOPUP_NEWDOC, NPPIDM_SYSTRAYPOPUP_NEW_AND_PASTE = IDM_SYSTRAYPOPUP_NEW_AND_PASTE, NPPIDM_SYSTRAYPOPUP_OPENFILE = IDM_SYSTRAYPOPUP_OPENFILE, NPPIDM_SYSTRAYPOPUP_CLOSE = IDM_SYSTRAYPOPUP_CLOSE, + NPPIDM_WINDOW_WINDOWS = IDM_WINDOW_WINDOWS, NPPIDM_WINDOW_SORT_FN_ASC = IDM_WINDOW_SORT_FN_ASC, NPPIDM_WINDOW_SORT_FN_DSC = IDM_WINDOW_SORT_FN_DSC, @@ -659,10 +659,24 @@ enum MenuCommands NPPIDM_WINDOW_MRU_LIMIT = IDM_WINDOW_MRU_LIMIT, NPPIDM_WINDOW_COPY_NAME = IDM_WINDOW_COPY_NAME, NPPIDM_WINDOW_COPY_PATH = IDM_WINDOW_COPY_PATH, + NPPIDM_DROPLIST_LIST = IDM_DROPLIST_LIST, NPPIDM_DROPLIST_MRU_FIRST = IDM_DROPLIST_MRU_FIRST }; +enum LineNumWidthMode +{ + LINENUMWIDTHMODE_DYNAMIC = LINENUMWIDTH_DYNAMIC, + LINENUMWIDTHMODE_CONSTANT = LINENUMWIDTH_CONSTANT + +}; + +enum AutoIndentMode +{ + AUTOINDENTMODE_STANDARD = 0, + AUTOINDENTMODE_CLIKE = 1, + AUTOINDENTMODE_CUSTOM = 2 +}; class NotepadPlusWrapper { @@ -869,6 +883,16 @@ class NotepadPlusWrapper boost::python::str getPluginVersion(); + bool NotepadPlusWrapper::setUntitledName(const char *newName, intptr_t bufferID); + int NotepadPlusWrapper::getTabColorID(int view, int tabIndex); + boost::python::str NotepadPlusWrapper::getNativeLangFileName(); + LineNumWidthMode getLineNumberWidthMode(); + bool setLineNumberWidthMode(LineNumWidthMode widthMode); + + boost::python::object NotepadPlusWrapper::getExternalLexerAutoIndentMode(const char* externalLexerName); + bool NotepadPlusWrapper::setExternalLexerAutoIndentMode(const char* externalLexerName, AutoIndentMode indentMode); + bool NotepadPlusWrapper::isAutoIndention(); + bool isSingleView() const; void flashWindow(UINT count, DWORD timeout) const; diff --git a/PythonScript/src/NotepadPython.cpp b/PythonScript/src/NotepadPython.cpp index 2413a104..01151fbf 100644 --- a/PythonScript/src/NotepadPython.cpp +++ b/PythonScript/src/NotepadPython.cpp @@ -126,6 +126,15 @@ void export_notepad() .def("getEnableThemeTextureFunc", &NotepadPlusWrapper::getEnableThemeTextureFunc, "TODO") .def("triggerTabbarContextMenu", &NotepadPlusWrapper::triggerTabbarContextMenu, boost::python::args("view, index2Activate"), "Activates the context menu for provided view and tab index") .def("disableAutoUpdate", &NotepadPlusWrapper::disableAutoUpdate, "Disables notepad++ auto update functionality") + .def("setUntitledName", &NotepadPlusWrapper::setUntitledName, (boost::python::arg("newName"), boost::python::arg("bufferID") = 0), "Sets a new name for an unnamed tab. If no bufferID is specified, the current tab is assumed") + .def("getTabColorID", &NotepadPlusWrapper::getTabColorID, (boost::python::arg("view") = -1, boost::python::arg("tabIndex ") = -1), "Gets the tab color id for the given view and tab index") + .def("getNativeLangFileName", &NotepadPlusWrapper::getNativeLangFileName, "Get the Current native language file name string") + .def("getLineNumberWidthMode", &NotepadPlusWrapper::getLineNumberWidthMode, "Get line number margin width mode") + .def("setLineNumberWidthMode", &NotepadPlusWrapper::setLineNumberWidthMode, boost::python::args("widthMode"), "Set line number margin width mode") + .def("getExternalLexerAutoIndentMode", &NotepadPlusWrapper::getExternalLexerAutoIndentMode, boost::python::args("externalLexerName"), "Get ExternalLexerAutoIndentMode for an installed external programming language.") + .def("setExternalLexerAutoIndentMode", &NotepadPlusWrapper::setExternalLexerAutoIndentMode, boost::python::args("externalLexerName", "indentMode"), "Set ExternalLexerAutoIndentMode for an installed external programming language.") + .def("isAutoIndention", &NotepadPlusWrapper::isAutoIndention, "Returns True if autoindention is enabled else False") + .def("isSingleView", &NotepadPlusWrapper::isSingleView, "True if only one view is used, False otherwise") .def("flashWindow", &NotepadPlusWrapper::flashWindow, boost::python::args("count", "milliseconds"), "Flashes notepad++ for the given count and timeout"); @@ -332,7 +341,6 @@ void export_notepad() boost::python::enum_("MENUCOMMAND") - .value("FILE", NPPIDM_FILE) .value("FILE_NEW", NPPIDM_FILE_NEW) .value("FILE_OPEN", NPPIDM_FILE_OPEN) .value("FILE_CLOSE", NPPIDM_FILE_CLOSE) @@ -359,9 +367,8 @@ void export_notepad() .value("FILE_OPEN_DEFAULT_VIEWER", NPPIDM_FILE_OPEN_DEFAULT_VIEWER) .value("FILE_CLOSEALL_UNCHANGED", NPPIDM_FILE_CLOSEALL_UNCHANGED) .value("FILE_CONTAININGFOLDERASWORKSPACE", NPPIDM_FILE_CONTAININGFOLDERASWORKSPACE) - .value("FILEMENU_LASTONE", NPPIDM_FILEMENU_LASTONE) .value("FILEMENU_EXISTCMDPOSITION", NPPIDM_FILEMENU_EXISTCMDPOSITION) - .value("EDIT", NPPIDM_EDIT) + .value("EDIT_CUT", NPPIDM_EDIT_CUT) .value("EDIT_COPY", NPPIDM_EDIT_COPY) .value("EDIT_UNDO", NPPIDM_EDIT_UNDO) @@ -467,7 +474,7 @@ void export_notepad() .value("EDIT_AUTOCOMPLETE_PATH", NPPIDM_EDIT_AUTOCOMPLETE_PATH) .value("EDIT_FUNCCALLTIP_PREVIOUS", NPPIDM_EDIT_FUNCCALLTIP_PREVIOUS) .value("EDIT_FUNCCALLTIP_NEXT", NPPIDM_EDIT_FUNCCALLTIP_NEXT) - .value("SEARCH", NPPIDM_SEARCH) + .value("SEARCH_FIND", NPPIDM_SEARCH_FIND) .value("SEARCH_FINDNEXT", NPPIDM_SEARCH_FINDNEXT) .value("SEARCH_REPLACE", NPPIDM_SEARCH_REPLACE) @@ -534,12 +541,12 @@ void export_notepad() .value("SEARCH_CHANGED_NEXT", NPPIDM_SEARCH_CHANGED_NEXT) .value("SEARCH_CHANGED_PREV", NPPIDM_SEARCH_CHANGED_PREV) .value("SEARCH_CLEAR_CHANGE_HISTORY", NPPIDM_SEARCH_CLEAR_CHANGE_HISTORY) - .value("MISC", NPPIDM_MISC) + .value("DOCLIST_FILESCLOSE", NPPIDM_DOCLIST_FILESCLOSE) .value("DOCLIST_FILESCLOSEOTHERS", NPPIDM_DOCLIST_FILESCLOSEOTHERS) .value("DOCLIST_COPYNAMES", NPPIDM_DOCLIST_COPYNAMES) .value("DOCLIST_COPYPATHS", NPPIDM_DOCLIST_COPYPATHS) - .value("VIEW", NPPIDM_VIEW) + .value("VIEW_TOOLBAR_REDUCE", NPPIDM_VIEW_TOOLBAR_REDUCE) .value("VIEW_TOOLBAR_ENLARGE", NPPIDM_VIEW_TOOLBAR_ENLARGE) .value("VIEW_TOOLBAR_STANDARD", NPPIDM_VIEW_TOOLBAR_STANDARD) @@ -653,7 +660,7 @@ void export_notepad() .value("VIEW_LOAD_IN_NEW_INSTANCE", NPPIDM_VIEW_LOAD_IN_NEW_INSTANCE) .value("VIEW_GOTO_START", NPPIDM_VIEW_GOTO_START) .value("VIEW_GOTO_END", NPPIDM_VIEW_GOTO_END) - .value("FORMAT", NPPIDM_FORMAT) + .value("FORMAT_TODOS", NPPIDM_FORMAT_TODOS) .value("FORMAT_TOUNIX", NPPIDM_FORMAT_TOUNIX) .value("FORMAT_TOMAC", NPPIDM_FORMAT_TOMAC) @@ -714,8 +721,7 @@ void export_notepad() .value("FORMAT_MAC_CYRILLIC", NPPIDM_FORMAT_MAC_CYRILLIC) .value("FORMAT_KOI8U_CYRILLIC", NPPIDM_FORMAT_KOI8U_CYRILLIC) .value("FORMAT_KOI8R_CYRILLIC", NPPIDM_FORMAT_KOI8R_CYRILLIC) - .value("FORMAT_ENCODE_END", NPPIDM_FORMAT_ENCODE_END) - .value("LANG", NPPIDM_LANG) + .value("LANGSTYLE_CONFIG_DLG", NPPIDM_LANGSTYLE_CONFIG_DLG) .value("LANG_C", NPPIDM_LANG_C) .value("LANG_CPP", NPPIDM_LANG_CPP) @@ -814,6 +820,7 @@ void export_notepad() .value("LANG_USER_DLG", NPPIDM_LANG_USER_DLG) .value("LANG_OPENUDLDIR", NPPIDM_LANG_OPENUDLDIR) .value("LANG_UDLCOLLECTION_PROJECT_SITE", NPPIDM_LANG_UDLCOLLECTION_PROJECT_SITE) + .value("ABOUT", NPPIDM_ABOUT) .value("HOMESWEETHOME", NPPIDM_HOMESWEETHOME) .value("PROJECTPAGE", NPPIDM_PROJECTPAGE) @@ -824,7 +831,7 @@ void export_notepad() .value("CONFUPDATERPROXY", NPPIDM_CONFUPDATERPROXY) .value("CMDLINEARGUMENTS", NPPIDM_CMDLINEARGUMENTS) .value("DEBUGINFO", NPPIDM_DEBUGINFO) - .value("SETTING", NPPIDM_SETTING) + .value("SETTING_IMPORTPLUGIN", NPPIDM_SETTING_IMPORTPLUGIN) .value("SETTING_IMPORTSTYLETHEMES", NPPIDM_SETTING_IMPORTSTYLETHEMES) .value("SETTING_TRAYICON", NPPIDM_SETTING_TRAYICON) @@ -836,7 +843,7 @@ void export_notepad() .value("SETTING_SHORTCUT_MAPPER_MACRO", NPPIDM_SETTING_SHORTCUT_MAPPER_MACRO) .value("SETTING_SHORTCUT_MAPPER_RUN", NPPIDM_SETTING_SHORTCUT_MAPPER_RUN) .value("SETTING_EDITCONTEXTMENU", NPPIDM_SETTING_EDITCONTEXTMENU) - .value("TOOL", NPPIDM_TOOL) + .value("TOOL_MD5_GENERATE", NPPIDM_TOOL_MD5_GENERATE) .value("TOOL_MD5_GENERATEFROMFILE", NPPIDM_TOOL_MD5_GENERATEFROMFILE) .value("TOOL_MD5_GENERATEINTOCLIPBOARD", NPPIDM_TOOL_MD5_GENERATEINTOCLIPBOARD) @@ -849,13 +856,15 @@ void export_notepad() .value("TOOL_SHA512_GENERATE", NPPIDM_TOOL_SHA512_GENERATE) .value("TOOL_SHA512_GENERATEFROMFILE", NPPIDM_TOOL_SHA512_GENERATEFROMFILE) .value("TOOL_SHA512_GENERATEINTOCLIPBOARD", NPPIDM_TOOL_SHA512_GENERATEINTOCLIPBOARD) + .value("EXECUTE", NPPIDM_EXECUTE) - .value("SYSTRAYPOPUP", NPPIDM_SYSTRAYPOPUP) + .value("SYSTRAYPOPUP_ACTIVATE", NPPIDM_SYSTRAYPOPUP_ACTIVATE) .value("SYSTRAYPOPUP_NEWDOC", NPPIDM_SYSTRAYPOPUP_NEWDOC) .value("SYSTRAYPOPUP_NEW_AND_PASTE", NPPIDM_SYSTRAYPOPUP_NEW_AND_PASTE) .value("SYSTRAYPOPUP_OPENFILE", NPPIDM_SYSTRAYPOPUP_OPENFILE) .value("SYSTRAYPOPUP_CLOSE", NPPIDM_SYSTRAYPOPUP_CLOSE) + .value("WINDOW_WINDOWS", NPPIDM_WINDOW_WINDOWS) .value("WINDOW_SORT_FN_ASC", NPPIDM_WINDOW_SORT_FN_ASC) .value("WINDOW_SORT_FN_DSC", NPPIDM_WINDOW_SORT_FN_DSC) @@ -869,8 +878,19 @@ void export_notepad() .value("WINDOW_MRU_LIMIT", NPPIDM_WINDOW_MRU_LIMIT) .value("WINDOW_COPY_NAME", NPPIDM_WINDOW_COPY_NAME) .value("WINDOW_COPY_PATH", NPPIDM_WINDOW_COPY_PATH) + .value("DROPLIST_LIST", NPPIDM_DROPLIST_LIST) .value("DROPLIST_MRU_FIRST", NPPIDM_DROPLIST_MRU_FIRST); + + boost::python::enum_("LINENUMWIDTHMODE") + .value("DYNAMIC", LINENUMWIDTHMODE_DYNAMIC) + .value("CONSTANT", LINENUMWIDTHMODE_CONSTANT); + + boost::python::enum_("AUTOINDENTMODE") + .value("STANDARD", AUTOINDENTMODE_STANDARD) + .value("CLIKE", AUTOINDENTMODE_CLIKE) + .value("CUSTOM", AUTOINDENTMODE_CUSTOM); + //lint +e1793 } diff --git a/docs/source/enums.rst b/docs/source/enums.rst index 65129294..55ffcbe9 100644 --- a/docs/source/enums.rst +++ b/docs/source/enums.rst @@ -2,6 +2,18 @@ Enums ===== +AUTOINDENTMODE +---------- + +.. _AUTOINDENTMODE: +.. class:: AUTOINDENTMODE + +.. attribute:: AUTOINDENTMODE.STANDARD + +.. attribute:: AUTOINDENTMODE.CLIKE + +.. attribute:: AUTOINDENTMODE.CUSTOM + FORMATTYPE ---------- @@ -310,8 +322,28 @@ MENUCOMMAND .. _MENUCOMMAND: .. class:: MENUCOMMAND +.. attribute:: MENUCOMMAND.ABOUT + .. attribute:: MENUCOMMAND.CLEAN_RECENT_FILE_LIST +.. attribute:: MENUCOMMAND.CMDLINEARGUMENTS + +.. attribute:: MENUCOMMAND.CONFUPDATERPROXY + +.. attribute:: MENUCOMMAND.DEBUGINFO + +.. attribute:: MENUCOMMAND.DOCLIST_COPYNAMES + +.. attribute:: MENUCOMMAND.DOCLIST_COPYPATHS + +.. attribute:: MENUCOMMAND.DOCLIST_FILESCLOSE + +.. attribute:: MENUCOMMAND.DOCLIST_FILESCLOSEOTHERS + +.. attribute:: MENUCOMMAND.DROPLIST_LIST + +.. attribute:: MENUCOMMAND.DROPLIST_MRU_FIRST + .. attribute:: MENUCOMMAND.EDIT_AUTOCOMPLETE .. attribute:: MENUCOMMAND.EDIT_AUTOCOMPLETE_CURRENTFILE @@ -320,6 +352,8 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.EDIT_BEGINENDSELECT +.. attribute:: MENUCOMMAND.EDIT_BEGINENDSELECT_COLUMNMODE + .. attribute:: MENUCOMMAND.EDIT_BLANKLINEABOVECURRENT .. attribute:: MENUCOMMAND.EDIT_BLANKLINEBELOWCURRENT @@ -344,8 +378,14 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.EDIT_COPY +.. attribute:: MENUCOMMAND.EDIT_COPY_ALL_NAMES + +.. attribute:: MENUCOMMAND.EDIT_COPY_ALL_PATHS + .. attribute:: MENUCOMMAND.EDIT_COPY_BINARY +.. attribute:: MENUCOMMAND.EDIT_COPY_LINK + .. attribute:: MENUCOMMAND.EDIT_CURRENTDIRTOCLIP .. attribute:: MENUCOMMAND.EDIT_CUT @@ -364,6 +404,16 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.EDIT_FUNCCALLTIP +.. attribute:: MENUCOMMAND.EDIT_FUNCCALLTIP_NEXT + +.. attribute:: MENUCOMMAND.EDIT_FUNCCALLTIP_PREVIOUS + +.. attribute:: MENUCOMMAND.EDIT_INSERT_DATETIME_CUSTOMIZED + +.. attribute:: MENUCOMMAND.EDIT_INSERT_DATETIME_LONG + +.. attribute:: MENUCOMMAND.EDIT_INSERT_DATETIME_SHORT + .. attribute:: MENUCOMMAND.EDIT_INS_TAB .. attribute:: MENUCOMMAND.EDIT_INVERTCASE @@ -378,6 +428,26 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.EDIT_LTR +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTALL + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTALLMATCHCASE + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTALLMATCHCASEWHOLEWORD + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTALLWHOLEWORD + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTNEXT + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTNEXTMATCHCASE + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTNEXTMATCHCASEWHOLEWORD + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTNEXTWHOLEWORD + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTSSKIP + +.. attribute:: MENUCOMMAND.EDIT_MULTISELECTUNDO + .. attribute:: MENUCOMMAND.EDIT_OPENASFILE .. attribute:: MENUCOMMAND.EDIT_OPENINFOLDER @@ -402,6 +472,10 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.EDIT_REMOVEEMPTYLINESWITHBLANK +.. attribute:: MENUCOMMAND.EDIT_REMOVE_ANY_DUP_LINES + +.. attribute:: MENUCOMMAND.EDIT_REMOVE_CONSECUTIVE_DUP_LINES + .. attribute:: MENUCOMMAND.EDIT_RMV_TAB .. attribute:: MENUCOMMAND.EDIT_RTL @@ -432,6 +506,14 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING +.. attribute:: MENUCOMMAND.EDIT_SORTLINES_LEXICO_CASE_INSENS_ASCENDING + +.. attribute:: MENUCOMMAND.EDIT_SORTLINES_LEXICO_CASE_INSENS_DESCENDING + +.. attribute:: MENUCOMMAND.EDIT_SORTLINES_RANDOMLY + +.. attribute:: MENUCOMMAND.EDIT_SORTLINES_REVERSE_ORDER + .. attribute:: MENUCOMMAND.EDIT_SPLIT_LINES .. attribute:: MENUCOMMAND.EDIT_STREAM_COMMENT @@ -458,16 +540,12 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.EDIT_UPPERCASE +.. attribute:: MENUCOMMAND.EXECUTE + .. attribute:: MENUCOMMAND.EXPORT_FUNC_LIST_AND_QUIT .. attribute:: MENUCOMMAND.FILEMENU_EXISTCMDPOSITION -.. attribute:: MENUCOMMAND.FILEMENU_LASTONE - -.. attribute:: MENUCOMMAND.FILESWITCHER_FILESCLOSE - -.. attribute:: MENUCOMMAND.FILESWITCHER_FILESCLOSEOTHERS - .. attribute:: MENUCOMMAND.FILE_CLOSE .. attribute:: MENUCOMMAND.FILE_CLOSEALL @@ -478,6 +556,10 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.FILE_CLOSEALL_TORIGHT +.. attribute:: MENUCOMMAND.FILE_CLOSEALL_UNCHANGED + +.. attribute:: MENUCOMMAND.FILE_CONTAININGFOLDERASWORKSPACE + .. attribute:: MENUCOMMAND.FILE_DELETE .. attribute:: MENUCOMMAND.FILE_EXIT @@ -528,9 +610,9 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.FORMAT_CONV2_AS_UTF_8 -.. attribute:: MENUCOMMAND.FORMAT_CONV2_UCS_2BE +.. attribute:: MENUCOMMAND.FORMAT_CONV2_UTF_16BE -.. attribute:: MENUCOMMAND.FORMAT_CONV2_UCS_2LE +.. attribute:: MENUCOMMAND.FORMAT_CONV2_UTF_16LE .. attribute:: MENUCOMMAND.FORMAT_CONV2_UTF_8 @@ -568,8 +650,6 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.FORMAT_ENCODE -.. attribute:: MENUCOMMAND.FORMAT_ENCODE_END - .. attribute:: MENUCOMMAND.FORMAT_EUC_KR .. attribute:: MENUCOMMAND.FORMAT_GB2312 @@ -616,9 +696,9 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.FORMAT_TOUNIX -.. attribute:: MENUCOMMAND.FORMAT_UCS_2BE +.. attribute:: MENUCOMMAND.FORMAT_UTF_16BE -.. attribute:: MENUCOMMAND.FORMAT_UCS_2LE +.. attribute:: MENUCOMMAND.FORMAT_UTF_16LE .. attribute:: MENUCOMMAND.FORMAT_UTF_8 @@ -642,8 +722,6 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.FORUM -.. attribute:: MENUCOMMAND.HELP - .. attribute:: MENUCOMMAND.HOMESWEETHOME .. attribute:: MENUCOMMAND.LANGSTYLE_CONFIG_DLG @@ -710,10 +788,16 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.LANG_FREEBASIC +.. attribute:: MENUCOMMAND.LANG_GDSCRIPT + +.. attribute:: MENUCOMMAND.LANG_GOLANG + .. attribute:: MENUCOMMAND.LANG_GUI4CLI .. attribute:: MENUCOMMAND.LANG_HASKELL +.. attribute:: MENUCOMMAND.LANG_HOLLYWOOD + .. attribute:: MENUCOMMAND.LANG_HTML .. attribute:: MENUCOMMAND.LANG_IHEX @@ -728,6 +812,8 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.LANG_JSON +.. attribute:: MENUCOMMAND.LANG_JSON5 + .. attribute:: MENUCOMMAND.LANG_JSP .. attribute:: MENUCOMMAND.LANG_KIX @@ -744,7 +830,9 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.LANG_MMIXAL -.. attribute:: MENUCOMMAND.LANG_NIMROD +.. attribute:: MENUCOMMAND.LANG_MSSQL + +.. attribute:: MENUCOMMAND.LANG_NIM .. attribute:: MENUCOMMAND.LANG_NNCRONTAB @@ -752,6 +840,8 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.LANG_OBJC +.. attribute:: MENUCOMMAND.LANG_OPENUDLDIR + .. attribute:: MENUCOMMAND.LANG_OSCRIPT .. attribute:: MENUCOMMAND.LANG_PASCAL @@ -772,6 +862,8 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.LANG_R +.. attribute:: MENUCOMMAND.LANG_RAKU + .. attribute:: MENUCOMMAND.LANG_RC .. attribute:: MENUCOMMAND.LANG_REBOL @@ -802,8 +894,14 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.LANG_TEXT +.. attribute:: MENUCOMMAND.LANG_TOML + .. attribute:: MENUCOMMAND.LANG_TXT2TAGS +.. attribute:: MENUCOMMAND.LANG_TYPESCRIPT + +.. attribute:: MENUCOMMAND.LANG_UDLCOLLECTION_PROJECT_SITE + .. attribute:: MENUCOMMAND.LANG_USER .. attribute:: MENUCOMMAND.LANG_USER_DLG @@ -832,18 +930,24 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.MACRO_STOPRECORDINGMACRO -.. attribute:: MENUCOMMAND.ONLINEHELP +.. attribute:: MENUCOMMAND.ONLINEDOCUMENT .. attribute:: MENUCOMMAND.OPEN_ALL_RECENT_FILE -.. attribute:: MENUCOMMAND.PLUGINSHOME - .. attribute:: MENUCOMMAND.PROJECTPAGE +.. attribute:: MENUCOMMAND.SEARCH_ALLSTYLESTOCLIP + +.. attribute:: MENUCOMMAND.SEARCH_CHANGED_NEXT + +.. attribute:: MENUCOMMAND.SEARCH_CHANGED_PREV + .. attribute:: MENUCOMMAND.SEARCH_CLEARALLMARKS .. attribute:: MENUCOMMAND.SEARCH_CLEAR_BOOKMARKS +.. attribute:: MENUCOMMAND.SEARCH_CLEAR_CHANGE_HISTORY + .. attribute:: MENUCOMMAND.SEARCH_COPYMARKEDLINES .. attribute:: MENUCOMMAND.SEARCH_CUTMARKEDLINES @@ -910,6 +1014,18 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.SEARCH_MARKALLEXT5 +.. attribute:: MENUCOMMAND.SEARCH_MARKEDTOCLIP + +.. attribute:: MENUCOMMAND.SEARCH_MARKONEEXT1 + +.. attribute:: MENUCOMMAND.SEARCH_MARKONEEXT2 + +.. attribute:: MENUCOMMAND.SEARCH_MARKONEEXT3 + +.. attribute:: MENUCOMMAND.SEARCH_MARKONEEXT4 + +.. attribute:: MENUCOMMAND.SEARCH_MARKONEEXT5 + .. attribute:: MENUCOMMAND.SEARCH_NEXT_BOOKMARK .. attribute:: MENUCOMMAND.SEARCH_PASTEMARKEDLINES @@ -924,6 +1040,16 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.SEARCH_SETANDFINDPREV +.. attribute:: MENUCOMMAND.SEARCH_STYLE1TOCLIP + +.. attribute:: MENUCOMMAND.SEARCH_STYLE2TOCLIP + +.. attribute:: MENUCOMMAND.SEARCH_STYLE3TOCLIP + +.. attribute:: MENUCOMMAND.SEARCH_STYLE4TOCLIP + +.. attribute:: MENUCOMMAND.SEARCH_STYLE5TOCLIP + .. attribute:: MENUCOMMAND.SEARCH_TOGGLE_BOOKMARK .. attribute:: MENUCOMMAND.SEARCH_UNMARKALLEXT1 @@ -944,9 +1070,13 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.SETTING_IMPORTPLUGIN -.. attribute:: MENUCOMMAND.SETTING_IMPORTSTYLETHEMS +.. attribute:: MENUCOMMAND.SETTING_IMPORTSTYLETHEMES + +.. attribute:: MENUCOMMAND.SETTING_OPENPLUGINSDIR + +.. attribute:: MENUCOMMAND.SETTING_PLUGINADM -.. attribute:: MENUCOMMAND.SETTING_PREFERECE +.. attribute:: MENUCOMMAND.SETTING_PREFERENCE .. attribute:: MENUCOMMAND.SETTING_REMEMBER_LAST_SESSION @@ -974,6 +1104,24 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.TOOL_MD5_GENERATEINTOCLIPBOARD +.. attribute:: MENUCOMMAND.TOOL_SHA1_GENERATE + +.. attribute:: MENUCOMMAND.TOOL_SHA1_GENERATEFROMFILE + +.. attribute:: MENUCOMMAND.TOOL_SHA1_GENERATEINTOCLIPBOARD + +.. attribute:: MENUCOMMAND.TOOL_SHA256_GENERATE + +.. attribute:: MENUCOMMAND.TOOL_SHA256_GENERATEFROMFILE + +.. attribute:: MENUCOMMAND.TOOL_SHA256_GENERATEINTOCLIPBOARD + +.. attribute:: MENUCOMMAND.TOOL_SHA512_GENERATE + +.. attribute:: MENUCOMMAND.TOOL_SHA512_GENERATEFROMFILE + +.. attribute:: MENUCOMMAND.TOOL_SHA512_GENERATEINTOCLIPBOARD + .. attribute:: MENUCOMMAND.UPDATE_NPP .. attribute:: MENUCOMMAND.VIEW_ALL_CHARACTERS @@ -984,7 +1132,9 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.VIEW_CURLINE_HILITING -.. attribute:: MENUCOMMAND.VIEW_DOCCHANGEMARGIN +.. attribute:: MENUCOMMAND.VIEW_DISTRACTIONFREE + +.. attribute:: MENUCOMMAND.VIEW_DOCLIST .. attribute:: MENUCOMMAND.VIEW_DOC_MAP @@ -1000,20 +1150,14 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.VIEW_DRAWTABBAR_VERTICAL -.. attribute:: MENUCOMMAND.VIEW_EDGEBACKGROUND - -.. attribute:: MENUCOMMAND.VIEW_EDGELINE - -.. attribute:: MENUCOMMAND.VIEW_EDGENONE - .. attribute:: MENUCOMMAND.VIEW_EOL .. attribute:: MENUCOMMAND.VIEW_FILEBROWSER -.. attribute:: MENUCOMMAND.VIEW_FILESWITCHER_PANEL - .. attribute:: MENUCOMMAND.VIEW_FOLD +.. attribute:: MENUCOMMAND.VIEW_FOLDALL + .. attribute:: MENUCOMMAND.VIEW_FOLDERMAGIN .. attribute:: MENUCOMMAND.VIEW_FOLDERMAGIN_ARROW @@ -1048,12 +1192,24 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.VIEW_GOTO_ANOTHER_VIEW +.. attribute:: MENUCOMMAND.VIEW_GOTO_END + .. attribute:: MENUCOMMAND.VIEW_GOTO_NEW_INSTANCE +.. attribute:: MENUCOMMAND.VIEW_GOTO_START + .. attribute:: MENUCOMMAND.VIEW_HIDELINES .. attribute:: MENUCOMMAND.VIEW_INDENT_GUIDE +.. attribute:: MENUCOMMAND.VIEW_IN_CHROME + +.. attribute:: MENUCOMMAND.VIEW_IN_EDGE + +.. attribute:: MENUCOMMAND.VIEW_IN_FIREFOX + +.. attribute:: MENUCOMMAND.VIEW_IN_IE + .. attribute:: MENUCOMMAND.VIEW_LINENUMBER .. attribute:: MENUCOMMAND.VIEW_LOAD_IN_NEW_INSTANCE @@ -1068,6 +1224,10 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.VIEW_MONITORING +.. attribute:: MENUCOMMAND.VIEW_NPC + +.. attribute:: MENUCOMMAND.VIEW_NPC_CCUNIEOL + .. attribute:: MENUCOMMAND.VIEW_POSTIT .. attribute:: MENUCOMMAND.VIEW_PROJECT_PANEL_1 @@ -1082,8 +1242,20 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.VIEW_SUMMARY +.. attribute:: MENUCOMMAND.VIEW_SWITCHTO_DOCLIST + +.. attribute:: MENUCOMMAND.VIEW_SWITCHTO_FILEBROWSER + +.. attribute:: MENUCOMMAND.VIEW_SWITCHTO_FUNC_LIST + .. attribute:: MENUCOMMAND.VIEW_SWITCHTO_OTHER_VIEW +.. attribute:: MENUCOMMAND.VIEW_SWITCHTO_PROJECT_PANEL_1 + +.. attribute:: MENUCOMMAND.VIEW_SWITCHTO_PROJECT_PANEL_2 + +.. attribute:: MENUCOMMAND.VIEW_SWITCHTO_PROJECT_PANEL_3 + .. attribute:: MENUCOMMAND.VIEW_SYMBOLMARGIN .. attribute:: MENUCOMMAND.VIEW_SYNSCROLLH @@ -1108,6 +1280,20 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.VIEW_TAB9 +.. attribute:: MENUCOMMAND.VIEW_TAB_COLOUR_1 + +.. attribute:: MENUCOMMAND.VIEW_TAB_COLOUR_2 + +.. attribute:: MENUCOMMAND.VIEW_TAB_COLOUR_3 + +.. attribute:: MENUCOMMAND.VIEW_TAB_COLOUR_4 + +.. attribute:: MENUCOMMAND.VIEW_TAB_COLOUR_5 + +.. attribute:: MENUCOMMAND.VIEW_TAB_COLOUR_NONE + +.. attribute:: MENUCOMMAND.VIEW_TAB_END + .. attribute:: MENUCOMMAND.VIEW_TAB_MOVEBACKWARD .. attribute:: MENUCOMMAND.VIEW_TAB_MOVEFORWARD @@ -1118,18 +1304,22 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.VIEW_TAB_SPACE -.. attribute:: MENUCOMMAND.VIEW_TOGGLE_FOLDALL - -.. attribute:: MENUCOMMAND.VIEW_TOGGLE_UNFOLDALL +.. attribute:: MENUCOMMAND.VIEW_TAB_START .. attribute:: MENUCOMMAND.VIEW_TOOLBAR_ENLARGE +.. attribute:: MENUCOMMAND.VIEW_TOOLBAR_ENLARGE_SET2 + .. attribute:: MENUCOMMAND.VIEW_TOOLBAR_REDUCE +.. attribute:: MENUCOMMAND.VIEW_TOOLBAR_REDUCE_SET2 + .. attribute:: MENUCOMMAND.VIEW_TOOLBAR_STANDARD .. attribute:: MENUCOMMAND.VIEW_UNFOLD +.. attribute:: MENUCOMMAND.VIEW_UNFOLDALL + .. attribute:: MENUCOMMAND.VIEW_UNFOLD_1 .. attribute:: MENUCOMMAND.VIEW_UNFOLD_2 @@ -1160,6 +1350,32 @@ MENUCOMMAND .. attribute:: MENUCOMMAND.WIKIFAQ +.. attribute:: MENUCOMMAND.WINDOW_COPY_NAME + +.. attribute:: MENUCOMMAND.WINDOW_COPY_PATH + +.. attribute:: MENUCOMMAND.WINDOW_MRU_FIRST + +.. attribute:: MENUCOMMAND.WINDOW_MRU_LIMIT + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FN_ASC + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FN_DSC + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FP_ASC + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FP_DSC + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FS_ASC + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FS_DSC + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FT_ASC + +.. attribute:: MENUCOMMAND.WINDOW_SORT_FT_DSC + +.. attribute:: MENUCOMMAND.WINDOW_WINDOWS + LANGTYPE -------- @@ -2434,6 +2650,16 @@ LINEENDTYPE .. attribute:: LINEENDTYPE.UNICODE +LINENUMWIDTHMODE +---------------- + +.. _LINENUMWIDTHMODE: +.. class:: LINENUMWIDTHMODE + +.. attribute:: LINENUMWIDTHMODE.DYNAMIC + +.. attribute:: LINENUMWIDTHMODE.CONSTANT + MARGINOPTION ------------ diff --git a/docs/source/notepad.rst b/docs/source/notepad.rst index c2f446ed..27546ff3 100644 --- a/docs/source/notepad.rst +++ b/docs/source/notepad.rst @@ -36,14 +36,14 @@ Notepad++ Object Returns the start number of the requested range -.. method:: notepad.allocateMarker(numberRequested) -> bool +.. method:: notepad.allocateMarker(numberRequested) -> int Allocates a range of marker numbers for Scintilla. Use this to stop marker number collisions with other plugins / scripts. Returns the start number of the requested range -.. method:: notepad.allocateIndicator(numberRequested) -> bool +.. method:: notepad.allocateIndicator(numberRequested) -> int Allocates a range of indicator numbers for Scintilla. Use this to stop indicator number collisions with other plugins / scripts. @@ -236,6 +236,13 @@ Notepad++ Object Returns :class:`BUFFERENCODING` +.. method:: notepad.getExternalLexerAutoIndentMode() -> AUTOINDENTMODE + + Gets the auto indent mode for an installed external programming language + + Returns :class:`AUTOINDENTMODE` + + .. method:: notepad.getFiles() -> list Gets a list of the open filenames. @@ -269,6 +276,24 @@ Notepad++ Object Returns :class:`LANGTYPE` +.. method:: notepad.getLineNumberWidthMode() -> LINENUMWIDTHMODE + + Gets the line number margin width mode + + Returns :class:`LINENUMWIDTHMODE` + + +.. method:: notepad.getNativeLangFileName() -> str + + Gets the current native language file name + + +.. method:: notepad.getTabColorID([view, [tabIndex] ]) -> int + + Gets the tab color id for the given view and tab index + If no view or tabIndex is given, then the currently active buffer is used. + + .. method:: notepad.getNppDir() -> str Gets the directory Notepad++ is running in (i.e. the location of notepad++.exe) @@ -336,6 +361,11 @@ Notepad++ Object ``True`` if it should be hidden, ``False`` if it should be shown +.. method:: notepad.isAutoIndention() -> bool + + Returns: ``True`` if auto indent mode is set, ``False`` otherwise + + .. method:: notepad.isDarkModeEnabled() -> bool Returns ``True`` if Dark Mode is enabled else ``False`` @@ -538,6 +568,13 @@ Notepad++ Object Sets the encoding of the given bufferID. Use the :class:`BUFFERENCODING` constants +.. method:: notepad.setExternalLexerAutoIndentMode(externalLexerName, indentMode) -> bool + + Sets the auto indent mode for an external programming language + + Returns: ``True`` if indentMode was set successful, ``False`` otherwise + + .. method:: notepad.setFormatType(formatType[, bufferID]) Sets the format type (i.e. Windows, Unix or Mac) of the specified buffer ID. @@ -554,11 +591,23 @@ Notepad++ Object ``True`` if smooth font should be set, ``False`` otherwise +.. method:: notepad.setLineNumberWidthMode(widthMode) -> bool + + Sets the line number margin width mode + + Returns: ``True`` if widthMode was set successful, ``False`` otherwise + + .. method:: notepad.setStatusBar(statusBarSection, text) Sets the status bar text. For statusBarSection, use one of the :class:`STATUSBARSECTION` constants. +.. method:: notepad.setUntitledName([bufferID]) + + Sets a new name for an unnamed tab. If no bufferID is specified, the current tab is assumed + + .. method:: notepad.showDocSwitcher(boolean) ``True`` if it should be hidden, ``False`` if it should be shown diff --git a/docs/source/scintilla.rst b/docs/source/scintilla.rst index 56fafc18..dba0c367 100644 --- a/docs/source/scintilla.rst +++ b/docs/source/scintilla.rst @@ -1794,7 +1794,7 @@ Scintilla Methods .. method:: editor.getSelectionHidden() -> bool - + See Scintilla documentation for `SCI_GETSELECTIONHIDDEN `_ @@ -5229,6 +5229,10 @@ Helper Methods that from Notepad++, which is actually the `Boost::Regex `_ implementation (specifically the Perl regular expression syntax). + IMPORTANT NOTE: + The replace function provided to editor.rereplace should not invoke additional calls to editor.rereplace or other replacement functions + that modify the same text being processed. Doing so may result in unpredictable behavior. + ``flags`` are from the re module (e.g. ``re.IGNORECASE``), so ``import re`` if you use the flags.