Skip to content

Commit

Permalink
Added term windows and multiscreen support to OpenOS. (no multithread…
Browse files Browse the repository at this point in the history
…ing though)

Also added wide character support to edit.lua
  • Loading branch information
mpmxyz committed Dec 24, 2015
1 parent f19dd57 commit 29c49e0
Show file tree
Hide file tree
Showing 12 changed files with 877 additions and 370 deletions.
17 changes: 10 additions & 7 deletions src/main/resources/assets/opencomputers/loot/OpenOS/bin/dmesg.lua
@@ -1,13 +1,16 @@
local event = require "event"
local component = require "component"
local term = require "term"
local keyboard = require "keyboard"

local args = {...}

local interactive = io.output() == io.stdout
local function gpu()
return select(2, term.getGPU())
end
local color, isPal, evt
if interactive then
color, isPal = component.gpu.getForeground()
color, isPal = gpu().getForeground()
end
io.write("Press 'Ctrl-C' to exit\n")
pcall(function()
Expand All @@ -17,13 +20,13 @@ pcall(function()
else
evt = table.pack(event.pull())
end
if interactive then component.gpu.setForeground(0xCC2200) end
if interactive then gpu().setForeground(0xCC2200) end
io.write("[" .. os.date("%T") .. "] ")
if interactive then component.gpu.setForeground(0x44CC00) end
if interactive then gpu().setForeground(0x44CC00) end
io.write(tostring(evt[1]) .. string.rep(" ", math.max(10 - #tostring(evt[1]), 0) + 1))
if interactive then component.gpu.setForeground(0xB0B00F) end
if interactive then gpu().setForeground(0xB0B00F) end
io.write(tostring(evt[2]) .. string.rep(" ", 37 - #tostring(evt[2])))
if interactive then component.gpu.setForeground(0xFFFFFF) end
if interactive then gpu().setForeground(0xFFFFFF) end
if evt.n > 2 then
for i = 3, evt.n do
io.write(" " .. tostring(evt[i]))
Expand All @@ -34,6 +37,6 @@ pcall(function()
until evt[1] == "interrupted"
end)
if interactive then
component.gpu.setForeground(color, isPal)
gpu().setForeground(color, isPal)
end

5 comments on commit 29c49e0

@payonel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in term.lua, the __gc of the metatable is assigned twice
29c49e0#diff-a97cafc4e4a993f5f6cf8eba5cedf0ffR22
Is that correct?

@mpmxyz
Copy link
Contributor Author

@mpmxyz mpmxyz commented on 29c49e0 Jan 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops... (I'll fix that in the next days.)
Btw.: You asked me to test parts of your changes to OpenOS? Where can I find them?

@payonel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sangar is reviewing my PR -- can we do one of two things

  1. wait to PR the fix, or
  2. push your fix to your own branch here and i'll merge it by hand into my PR
    Sangar is reviewing my enormous PR, and I'm working on reducing memory cost to openos boot
    I should have 2 PRs for openos 1.6, the first is the bulk of the work, the 2nd will mainly be memory optimizations (with a few minor bug fixes I find along the way)
    PR1: openos overhaul, bash like shell and more bin utils #1610
    You can test that to verify your terminal code

@fnuecke
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in the process of getting rid of __gcs right now (see #1606). For file handles I'm adding a userdata handle wrapper, for this... I'll just remove it. Yes, things may derp around when a window is 'lost', but that's not a big issue compared to real resources (as is potentially the case with file handles).

@mpmxyz
Copy link
Contributor Author

@mpmxyz mpmxyz commented on 29c49e0 Jan 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workaround isn't that hard. Stopping the cursor blink can be moved to the toggleblink and the neighbour lists need some additional data to detect "gaps".

Please sign in to comment.