void-packages/srcpkgs/solvespace/patches/char_width.patch
Đoàn Trần Công Danh 4b97cd2fb4 srcpkgs/s*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

91 lines
3.5 KiB
Diff

--- a/src/textwin.cpp 2017-04-16 04:00:21.000000000 -0500
+++ b/src/textwin.cpp 2019-02-01 00:47:55.270922800 -0600
@@ -85,7 +85,7 @@
editControl.halfRow = halfRow;
editControl.col = col;
- int x = LEFT_MARGIN + CHAR_WIDTH*col;
+ int x = LEFT_MARGIN + CHAR_WIDTH_*col;
int y = (halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
ShowTextEditControl(x, y + 18, str);
@@ -447,7 +447,7 @@
double ox = oldMousePos.x, oy = oldMousePos.y - LINE_HEIGHT;
ox += 3;
oy -= 3;
- int tw = (str.length() + 1)*(CHAR_WIDTH - 1);
+ int tw = (str.length() + 1)*(CHAR_WIDTH_ - 1);
ox = min(ox, (double) (width - 25) - tw);
oy = max(oy, 5.0);
@@ -583,7 +583,7 @@
int width, height;
GetTextWindowSize(&width, &height);
- int px = LEFT_MARGIN + CHAR_WIDTH*editControl.col;
+ int px = LEFT_MARGIN + CHAR_WIDTH_*editControl.col;
int py = (editControl.halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
py += LINE_HEIGHT + 5;
@@ -842,8 +842,8 @@
if(ltop < (scrollPos-1)) continue;
if(ltop > scrollPos+halfRows) break;
- for(c = 0; c < min((width/CHAR_WIDTH)+1, (int) MAX_COLS); c++) {
- int x = LEFT_MARGIN + c*CHAR_WIDTH;
+ for(c = 0; c < min((width/CHAR_WIDTH_)+1, (int) MAX_COLS); c++) {
+ int x = LEFT_MARGIN + c*CHAR_WIDTH_;
int y = (ltop-scrollPos)*(LINE_HEIGHT/2) + 4;
int fg = meta[r][c].fg;
@@ -866,7 +866,7 @@
// Move the quad down a bit, so that the descenders
// still have the correct background.
y += adj;
- ssglAxisAlignedQuad(x, x + CHAR_WIDTH, y, y + bh, false);
+ ssglAxisAlignedQuad(x, x + CHAR_WIDTH_, y, y + bh, false);
y -= adj;
}
} else if(a == 1) {
@@ -912,8 +912,8 @@
glLineWidth(1);
glBegin(GL_LINES);
int yp = y + CHAR_HEIGHT;
- glVertex2d(LEFT_MARGIN + cs*CHAR_WIDTH, yp);
- glVertex2d(LEFT_MARGIN + cf*CHAR_WIDTH, yp);
+ glVertex2d(LEFT_MARGIN + cs*CHAR_WIDTH_, yp);
+ glVertex2d(LEFT_MARGIN + cf*CHAR_WIDTH_, yp);
glEnd();
glEnable(GL_TEXTURE_2D);
@@ -979,7 +979,7 @@
hoveredCol = 0;
// Find the corresponding character in the text buffer
- int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH);
+ int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH_);
int hh = (LINE_HEIGHT)/2;
y += scrollPos*hh;
int r;
--- a/src/toolbar.cpp 2017-04-16 03:56:19.000000000 -0500
+++ b/src/toolbar.cpp 2019-02-01 00:47:55.270922800 -0600
@@ -218,7 +218,7 @@
}
}
- int tw = str.length() * (SS.TW.CHAR_WIDTH - 1) + 10,
+ int tw = str.length() * (SS.TW.CHAR_WIDTH_ - 1) + 10,
th = SS.TW.LINE_HEIGHT + 2;
double ox = toolbarMouseX + 3, oy = toolbarMouseY + 3;
--- a/src/ui.h 2017-04-16 04:00:07.000000000 -0500
+++ b/src/ui.h 2019-02-01 00:47:55.270922800 -0600
@@ -27,7 +27,7 @@
float fgColorTable[256*3];
enum {
- CHAR_WIDTH = 9,
+ CHAR_WIDTH_ = 9,
CHAR_HEIGHT = 16,
LINE_HEIGHT = 20,
LEFT_MARGIN = 6,