Skip to content

Commit 29c49e0

Browse files
committedDec 24, 2015
Added term windows and multiscreen support to OpenOS. (no multithreading though)
Also added wide character support to edit.lua

File tree

12 files changed

+877
-370
lines changed

12 files changed

+877
-370
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
local event = require "event"
2-
local component = require "component"
2+
local term = require "term"
33
local keyboard = require "keyboard"
44

55
local args = {...}
66

77
local interactive = io.output() == io.stdout
8+
local function gpu()
9+
return select(2, term.getGPU())
10+
end
811
local color, isPal, evt
912
if interactive then
10-
color, isPal = component.gpu.getForeground()
13+
color, isPal = gpu().getForeground()
1114
end
1215
io.write("Press 'Ctrl-C' to exit\n")
1316
pcall(function()
@@ -17,13 +20,13 @@ pcall(function()
1720
else
1821
evt = table.pack(event.pull())
1922
end
20-
if interactive then component.gpu.setForeground(0xCC2200) end
23+
if interactive then gpu().setForeground(0xCC2200) end
2124
io.write("[" .. os.date("%T") .. "] ")
22-
if interactive then component.gpu.setForeground(0x44CC00) end
25+
if interactive then gpu().setForeground(0x44CC00) end
2326
io.write(tostring(evt[1]) .. string.rep(" ", math.max(10 - #tostring(evt[1]), 0) + 1))
24-
if interactive then component.gpu.setForeground(0xB0B00F) end
27+
if interactive then gpu().setForeground(0xB0B00F) end
2528
io.write(tostring(evt[2]) .. string.rep(" ", 37 - #tostring(evt[2])))
26-
if interactive then component.gpu.setForeground(0xFFFFFF) end
29+
if interactive then gpu().setForeground(0xFFFFFF) end
2730
if evt.n > 2 then
2831
for i = 3, evt.n do
2932
io.write(" " .. tostring(evt[i]))
@@ -34,6 +37,6 @@ pcall(function()
3437
until evt[1] == "interrupted"
3538
end)
3639
if interactive then
37-
component.gpu.setForeground(color, isPal)
40+
gpu().setForeground(color, isPal)
3841
end
3942

5 commit comments

Comments
 (5)

payonel commented on Jan 20, 2016

@payonel
Member

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

mpmxyz commented on Jan 20, 2016

@mpmxyz
ContributorAuthor

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 commented on Jan 20, 2016

@payonel
Member

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 commented on Jan 31, 2016

@fnuecke
Member

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 commented on Jan 31, 2016

@mpmxyz
ContributorAuthor

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.