Fix line number rendering
This commit is contained in:
@@ -85,6 +85,21 @@ int LuaListWindows(lua_State *L) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaOpenBigBuffer(lua_State *L) {
|
||||||
|
Window *window = GetWindow(GetLastActiveWindow());
|
||||||
|
|
||||||
|
// @todo: ViewOpenBuffer - new or old view for specified buffer
|
||||||
|
Buffer *buffer = CreateBuffer(GetSystemAllocator(), "big", 2500000 * 4);
|
||||||
|
LoadBigTextAndBigLine(buffer);
|
||||||
|
View *view = CreateView(buffer->id);
|
||||||
|
|
||||||
|
AddView(window, view->id);
|
||||||
|
window->active_view = view->id;
|
||||||
|
|
||||||
|
SetActiveWindow(window->id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void InitLua() {
|
void InitLua() {
|
||||||
LuaState = luaL_newstate();
|
LuaState = luaL_newstate();
|
||||||
luaL_openlibs(LuaState);
|
luaL_openlibs(LuaState);
|
||||||
@@ -100,6 +115,9 @@ void InitLua() {
|
|||||||
|
|
||||||
lua_pushcfunction(LuaState, LuaListWindows);
|
lua_pushcfunction(LuaState, LuaListWindows);
|
||||||
lua_setglobal(LuaState, "list_windows");
|
lua_setglobal(LuaState, "list_windows");
|
||||||
|
|
||||||
|
lua_pushcfunction(LuaState, LuaOpenBigBuffer);
|
||||||
|
lua_setglobal(LuaState, "open_big_buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
String16 EvalString(Allocator allocator, String16 string16) {
|
String16 EvalString(Allocator allocator, String16 string16) {
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ int main(void) {
|
|||||||
|
|
||||||
Rect2I screen_rect = GetScreenRect();
|
Rect2I screen_rect = GetScreenRect();
|
||||||
Rect2I infobar_rect = CutBottom(&screen_rect, (Int)FontLineSpacing);
|
Rect2I infobar_rect = CutBottom(&screen_rect, (Int)FontLineSpacing);
|
||||||
float line_numbers_size = MeasureTextEx(MainFont, "12345", (float)FontSize, (float)FontSpacing).x;
|
float line_numbers_size = MeasureTextEx(MainFont, "1234567891", (float)FontSize, (float)FontSpacing).x;
|
||||||
{
|
{
|
||||||
int i = 5;
|
int i = 5;
|
||||||
if (Windows[i].visible) {
|
if (Windows[i].visible) {
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ void DrawWindow(Window &window) {
|
|||||||
Vec2 p = ToVec2(pos);
|
Vec2 p = ToVec2(pos);
|
||||||
float rectx = (float)GetSize(r).x;
|
float rectx = (float)GetSize(r).x;
|
||||||
p.x += (rectx - x) / 2.f;
|
p.x += (rectx - x) / 2.f;
|
||||||
if (x > rectx) p.x = 0;
|
if (x > rectx) p.x = (float)r.min.x;
|
||||||
DrawString(MainFont, string, p, (float)FontSize, (float)FontSpacing, ColorTextLineNumbers);
|
DrawString(MainFont, string, p, (float)FontSize, (float)FontSpacing, ColorTextLineNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user