1
7
Fork
You've already forked debugger.lua
0

Solves #35 and #12 #59

Merged
ghost merged 1 commit from patch-1 into develop 2019年02月27日 18:14:48 +01:00
ghost commented 2019年02月23日 02:52:46 +01:00 (Migrated from github.com)
Copy link

Used C preprocessor to define a macro depending on the OS used.

Solves #12 and #35 issues.

@slembcke

Used C preprocessor to define a macro depending on the OS used. Solves #12 and #35 issues. @slembcke
ghost commented 2019年02月23日 18:22:09 +01:00 (Migrated from github.com)
Copy link

If you want true color support I can help you do it.

If you want true color support I can help you do it.
slembcke commented 2019年02月25日 20:39:23 +01:00 (Migrated from github.com)
Copy link

Do preprocessor commands work in newer versions of LuaJIT? My machines have 2.1b3 and it throws errors for them. Seems like that's the newest version?

This works on Linux and Mac at least:

if ffi then
	ffi.cdef[[
		int isatty(int); // Unix
		int _isatty(int); // Windows
		void free(void *ptr);
		
		char *readline(const char *);
		int add_history(const char *);
	]]
	
	local function get_func_or_nil(sym)
		local success, func = pcall(function() return ffi.C[sym] end)
		return success and func or nil
	end
	
	local isatty = get_func_or_nil("_isatty") or get_func_or_nil("isatty")
	stdin_isatty = isatty(0)
	stdout_isatty = isatty(1)
end

I'll push it to a branch if you are willing to test it. (https://github.com/slembcke/debugger.lua/tree/patch-59)

Do preprocessor commands work in newer versions of LuaJIT? My machines have 2.1b3 and it throws errors for them. Seems like that's the newest version? This works on Linux and Mac at least: ``` if ffi then ffi.cdef[[ int isatty(int); // Unix int _isatty(int); // Windows void free(void *ptr); char *readline(const char *); int add_history(const char *); ]] local function get_func_or_nil(sym) local success, func = pcall(function() return ffi.C[sym] end) return success and func or nil end local isatty = get_func_or_nil("_isatty") or get_func_or_nil("isatty") stdin_isatty = isatty(0) stdout_isatty = isatty(1) end ``` I'll push it to a branch if you are willing to test it. (https://github.com/slembcke/debugger.lua/tree/patch-59)
ghost commented 2019年02月26日 02:00:21 +01:00 (Migrated from github.com)
Copy link

I was running Manjaro Linux with latest LuaJIT.

I was running Manjaro Linux with latest LuaJIT.
slembcke commented 2019年02月26日 03:01:32 +01:00 (Migrated from github.com)
Copy link

Hmm. The code in master works fine for me on Ubuntu and Mac (my main systems). I'm not really sure what to test on Windows since there are a bajillion combinations of Lua versions and installation methods.

CI: That would be great! I've never actually looked into how to set up any CI testing.

Hmm. The code in master works fine for me on Ubuntu and Mac (my main systems). I'm not really sure what to test on Windows since there are a bajillion combinations of Lua versions and installation methods. CI: That would be great! I've never actually looked into how to set up any CI testing.
ghost commented 2019年02月26日 03:06:28 +01:00 (Migrated from github.com)
Copy link

I will think about it.

I will think about it.
ghost commented 2019年02月27日 05:58:29 +01:00 (Migrated from github.com)
Copy link

@slembcke Your code works on windows! But ... ansi color support is off by default on Windows 😢.
Don't expect from powershell (or even worse cmd) to colorize text be default.

image

I used a third party console emulator called Cmder.
Colors show up correctly in Cmder!

image

@slembcke Your code **works** on windows! But ... ansi color support is off by default on Windows 😢. Don't expect from powershell (or even worse cmd) to colorize text be default. ![image](https://user-images.githubusercontent.com/1548352/53467049-044c7580-3a5d-11e9-8888-b6d548a39f98.png) I used a third party console emulator called [Cmder](https://cmder.net/). Colors show up correctly in Cmder! ![image](https://user-images.githubusercontent.com/1548352/53467031-f1d23c00-3a5c-11e9-8326-2083b8cf6e26.png)
ghost commented 2019年02月27日 05:59:31 +01:00 (Migrated from github.com)
Copy link

Some other people have tried coloring text using lua and C bindings as well and they run into the same problem. Take a look at this project for example https://github.com/kikito/ansicolors.lua

I would say that you did the best you could.

Some other people have tried coloring text using lua and C bindings as well and they run into the same problem. Take a look at this project for example https://github.com/kikito/ansicolors.lua I would say that you did the best you could.
slembcke commented 2019年02月27日 18:19:17 +01:00 (Migrated from github.com)
Copy link

Yeah... I'm don't really want to go down the rabbit hole of particularly robust color console support. I have a variable called color_maybe_supported that I enable it with. Hehe

Yeah... I'm don't really want to go down the rabbit hole of particularly robust color console support. I have a variable called `color_maybe_supported` that I enable it with. Hehe
PatrickDahlin commented 2021年12月03日 00:01:16 +01:00 (Migrated from github.com)
Copy link

This is still an active issue it seems
image

This is still an active issue it seems ![image](https://user-images.githubusercontent.com/33965707/144516733-de126d96-87b2-4d90-836d-295d52e7ecf7.png)
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slembcke/debugger.lua!59
Reference in a new issue
slembcke/debugger.lua
No description provided.
Delete branch "patch-1"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?