瀏覽代碼

Scintilla UTF8 fix + Win Listbox fix (#61)

* Fixes #45

Is this an acceptable fix?

* Fixes some UTF8 character bugs
Carl Husberg 2 年之前
父節點
當前提交
4061e1c41f
共有 2 個文件被更改,包括 9 次插入4 次删除
  1. 5 1
      maxguitextareascintilla.mod/glue.c
  2. 4 3
      win32maxguiex.mod/win32maxguiex.bmx

+ 5 - 1
maxguitextareascintilla.mod/glue.c

@@ -178,7 +178,11 @@ void bmx_mgta_scintilla_startendfromchar(SCI_HANDLE sci, int pos, int length, in
 }
 
 int bmx_mgta_scintilla_positionfromline(SCI_HANDLE sci, int line, int valueInBytes) {
-	return scintilla_send_message(sci, SCI_INDEXPOSITIONFROMLINE, line, SC_LINECHARACTERINDEX_UTF16);
+	if (valueInBytes){
+		return scintilla_send_message(sci, SCI_POSITIONFROMLINE, line, 0);
+	} else {
+		return scintilla_send_message(sci, SCI_INDEXPOSITIONFROMLINE, line, SC_LINECHARACTERINDEX_UTF16);
+	}
 }
 
 void bmx_mgta_scintilla_setselectionstart(SCI_HANDLE sci, int pos) {

+ 4 - 3
win32maxguiex.mod/win32maxguiex.bmx

@@ -2798,7 +2798,8 @@ Type TWindowsListBox Extends TWindowsGadget
 		If Not IsSingleSelect() Then SelectionChanged()
 		Sensitize()
 		MemFree it.pszText()
-
+		
+		SendMessageW _hwnd,LVM_SETCOLUMNWIDTH,0,LVSCW_AUTOSIZE_USEHEADER
 	EndMethod
 
 	Method SetListItem(index,Text$,tip$,icon,tag:Object)
@@ -3188,9 +3189,9 @@ Type TWindowsToolbar Extends TWindowsGadget
 	'Use this method to grayscale/fade-out a given pixmap and assign the contained icons
 	'as disabled icons.
 	Method CreateDisabledIconStrip:TIconStrip(pixmap:TPixmap, saturation:Float = 0.1, alpha:Float = 0.4)
-		if not pixmap then return
+		If Not pixmap Then Return
 		'work on a copy to avoid manipulating the original pixmap data
-		local disabledPixmap:TPixmap = pixmap.copy()
+		Local disabledPixmap:TPixmap = pixmap.copy()
 		'grayscale and fadeout each pixel
 		For Local x:Int = 0 Until pixmap.width
 			For Local y:Int = 0 Until pixmap.height