Skip to content

Commit

Permalink
Force modified state in Text Editor for mouse Cut and Paste
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Jul 19, 2024
1 parent d411555 commit 1e4080d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from time import time

import wx
from wx import stc, Colour
from wx import stc, Colour, MenuEvent
from wx.adv import HyperlinkCtrl, EVT_HYPERLINK
from multiprocessing import shared_memory
from .popupwindow import HtmlPopupWindow
Expand Down Expand Up @@ -86,7 +86,7 @@ def obtain_language(existing, content):
# print(f"DEBUG: textedit.py validate_and_update obtain_language={doc_lang}")
if doc_lang is not None:
try:
mlang = Language.from_name(doc_lang.replace('_','-'))
mlang = Language.from_name(doc_lang.replace('_', '-'))
except ValueError as e:
raise e
set_lang[0] = get_rf_lang_code(mlang.code) # .code.replace('-','_')
Expand Down Expand Up @@ -543,8 +543,8 @@ def _txt_data(self, data):
language=self._doc_language)
text = output.getvalue()
# if self._reformat: # DEBUG: This is a good place to call Tidy
# text = self.collapse_blanks(text) # This breaks formatting in Templated tests
# print(f"DEBUG: textedit.py DataFileWrapper content _txt_data = {text=} language={self._doc_language}")
# text = self.collapse_blanks(text) # This breaks formatting in Templated tests
# print(f"DEBUG: textedit.py DataFileWrapper content _txt_data = {text=} language={self._doc_language}")
return text

""" DEBUG: This is no longer used
Expand Down Expand Up @@ -1204,8 +1204,15 @@ def _create_editor_text_control(self, text=None, language=None):
self.source_editor.Bind(wx.EVT_MOTION, self.on_mouse_motion)
self.source_editor.Bind(wx.EVT_KILL_FOCUS, self.LeaveFocus)
self.source_editor.Bind(wx.EVT_SET_FOCUS, self.GetFocus)
self.source_editor.Bind(wx.EVT_MENU, self.on_menu)
# DEBUG: Add here binding for keyword help

def on_menu(self, event):
m_id=event.GetId()
if m_id in (12, 14): # Cut and Paste
self.mark_file_dirty(True) # DEBUG: Forcing dirty, even if it may not be
event.Skip()

def LeaveFocus(self, event):
__ = event
self.source_editor.hide_kw_doc()
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#
# Automatically generated by `tasks.py`.

VERSION = 'v2.1dev57'
VERSION = 'v2.1dev58'

0 comments on commit 1e4080d

Please sign in to comment.