wineconsole: Add InsertMode registry entries

Hugh McMaster hugh.mcmaster at outlook.com
Fri May 1 00:46:53 CDT 2015


The default registry setting for InsertMode is 1 (i.e. enabled).
This is confirmed by http://testbot.winehq.org/JobDetails.pl?Key=13157, which
compared the InsertMode registry value with 1. All 14 tests passed.

This patch is part of the fix for https://bugs.winehq.org/show_bug.cgi?id=36704
(wine cmd uses overwrite mode instead of insert mode).

---
 programs/wineconsole/registry.c        | 9 +++++++++
 programs/wineconsole/winecon_private.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/programs/wineconsole/registry.c b/programs/wineconsole/registry.c
index 2805f2a..e7e7547 100644
--- a/programs/wineconsole/registry.c
+++ b/programs/wineconsole/registry.c
@@ -40,6 +40,7 @@ static const WCHAR wszFontSize[]          = {'F','o','n','t','S','i','z','e',0};
 static const WCHAR wszFontWeight[]        = {'F','o','n','t','W','e','i','g','h','t',0};
 static const WCHAR wszHistoryBufferSize[] = {'H','i','s','t','o','r','y','B','u','f','f','e','r','S','i','z','e',0};
 static const WCHAR wszHistoryNoDup[]      = {'H','i','s','t','o','r','y','N','o','D','u','p',0};
+static const WCHAR wszInsertMode[]        = {'I','n','s','e','r','t','M','o','d','e',0};
 static const WCHAR wszMenuMask[]          = {'M','e','n','u','M','a','s','k',0};
 static const WCHAR wszQuickEdit[]         = {'Q','u','i','c','k','E','d','i','t',0};
 static const WCHAR wszScreenBufferSize[]  = {'S','c','r','e','e','n','B','u','f','f','e','r','S','i','z','e',0};
@@ -126,6 +127,10 @@ static void WINECON_RegLoadHelper(HKEY hConKey, struct config_data* cfg)
         cfg->history_nodup = val;
 
     count = sizeof(val);
+    if (!RegQueryValueExW(hConKey, wszInsertMode, 0, &type, (LPBYTE)&val, &count))
+        cfg->insert_mode = val;
+
+    count = sizeof(val);
     if (!RegQueryValueExW(hConKey, wszMenuMask, 0, &type, (LPBYTE)&val, &count))
         cfg->menu_mask = val;
 
@@ -175,6 +180,7 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg)
     cfg->font_weight = 0;
     cfg->history_size = 50;
     cfg->history_nodup = 0;
+    cfg->insert_mode = 1;
     cfg->menu_mask = 0;
     cfg->quick_edit = 0;
     cfg->sb_height = 25;
@@ -245,6 +251,9 @@ static void WINECON_RegSaveHelper(HKEY hConKey, const struct config_data* cfg)
     val = cfg->history_nodup;
     RegSetValueExW(hConKey, wszHistoryNoDup, 0, REG_DWORD, (LPBYTE)&val, sizeof(val));
 
+    val = cfg->insert_mode;
+    RegSetValueExW(hConKey, wszInsertMode, 0, REG_DWORD, (LPBYTE)&val, sizeof(val));
+
     val = cfg->menu_mask;
     RegSetValueExW(hConKey, wszMenuMask, 0, REG_DWORD, (LPBYTE)&val, sizeof(val));
 
diff --git a/programs/wineconsole/winecon_private.h b/programs/wineconsole/winecon_private.h
index eec4171..2178dd0 100644
--- a/programs/wineconsole/winecon_private.h
+++ b/programs/wineconsole/winecon_private.h
@@ -36,6 +36,7 @@ struct config_data {
     DWORD       font_weight;
     DWORD       history_size;   /* number of commands in history buffer */
     DWORD       history_nodup;  /* TRUE if commands are not stored twice in buffer */
+    DWORD       insert_mode;    /* TRUE to insert text at the cursor location; FALSE to overwrite it */
     DWORD       menu_mask;      /* MK_CONTROL MK_SHIFT mask to drive submenu opening */
     DWORD       quick_edit;     /* whether mouse ops are sent to app (false) or used for content selection (true) */
     unsigned	sb_width;	/* active screen buffer width */
-- 
1.9.1




More information about the wine-patches mailing list