Skip to content

Conversation

rjkroege
Copy link

@rjkroege rjkroege commented Mar 3, 2018

There are a lot of changes here. It's mostly about getting frame.Insert and frame.Delete working along with a demonstration. I didn't do a very good job of merging / grouping these CLs together so I can understand if you might not want to take this PR.

I expect to make a lot more changes (more idiomatic go, more tests, more features) eventually.

If you have abandoned this project and don't care too much, I'm happy to take it over. Anyway, let me know your thoughts.

WIP CL: adding a demo program for the Frame implementation.
Added improved comments from the P9P frame(3) documentation
Frame names the slots in its array of colours. These names show up in
the consumers of the Frame API so expose them.
Rationalized use of integer types througout. Some improved
function/method docs. Corrected offsets into box array so that we can
insert and display an arbitrary string.
Simple frame demo can now draw a single text string.
Added a unitest for runeindex
An insert that splits a box results in the correct box model: there is
the original prefix of the split string, the insertion and the suffix
of the split string.

Also added additional boxmodel unit tests.
Added a utility function Logboxes to display the current box model.
Highly handy to see how the box model changes.
Inserting a simple (non-linebreaking) string correctly repositions the
boxes and redraws the string in the new position.
merge had an issue caused by how slices share their backing array. Fix
this by creasting a new slice.
A series of changes to make the insertion of multibyte characters work
correctly.
Modify the test code to insert a multi-line string. Fix the code to
handle correctly.
Add a basic model to framedemo. Add cursor motion. Bring the displayed
contents of the frame and the framedemo model into correspondence.
Dispatch key events to the model and update.
Make better mock boxes in box_test.
Adjust the verbosity of logging to start fixing bugs in the
implementation of delete.
Extend framedemo to permit cursor motion and insertion and deletion of
characters. This version of framedemo is sufficient to demonstrate
simple operation of Insert and Delete in frame.
Change modifies addbox to be more idiomatic and adds a complete
unittest.
Removed some unnecessary output logging.
Ran gofmt on box_test.go.
Factor out duplicated code from box model tests as a prelude to
writing additional tests.
Added unittest for closebox.
Added a test for dupbox.
Refactored frame to permit mocking draw.Font and use this capability
to start writing unittests for splitbox.
Add some more splitbox boundary condition tests.
Added unittests for mergebox.
Removed some logging from the box code now that it has better test
coverage.
Added unittests for findbox.
rjkroege and others added 30 commits March 1, 2018 06:45
Start of unittests for disk code.
Completed adding unit tests for disk.
Uses a slice of ElogOperations instead of the typeless buffer
in the C version.  Forgoes all the flush logic in favor of managing
explicit additions.

Re-uses allocations as far as possible to avoid making garbage.

Does not coallesce Replace operations - they seem rare.  Can implement
if we need them.

Texter interface exposes the operations done on a Text from elog,
allowing implementation of a test harness.  Probably this object should
be called a "Selection Buffer", as it manages a Buffer with a Selection.

The TextMock implementation in elog_test.go is probably a fullish
buff.go implementation.
I added a link to the Go report card for the project.
I can gofmt post-merge to clean some things up.
Better readme update.
CL does a bunch of restructurings to make it easier to write frame tests.
Added unittest for bxscan, fixed bug exposed by test.
Fix Go report card nit in util.go.
Additional Go report card formatting nits fixed.
Yet more formatting nits from Go report card.
Restructure code in boxtest_helpers_test.go to reduce cyclomatic
complexity.
The C version of the Frame object has a number of fields that can be
read and sometimes written from outside. This is an unfortunate
encapsulation violation and can make it harder to reason about the
code. Start formalizing which of these can be private and which public
and provide accessors for some of the existing private fields that are
obviously used by an Acme text instance.
Use an alpha blended tick to avoid causing pixel damage to fat round
letters (i.e. the rightmost edge of "b".) Also, clean up the initial
tick backing.
The _tick name isn't very Go. Make it tick instead.
Correctly complete changing _tick to tick.
Added a text generation feature to insert larger runs of random
structured text and fixed some Myframe bugs with long insert and
append past the end of a buffer.
Fix yet another issue with renaming in frame and expose the public
Drawsel0 API entry point.
Tiny formatting change to frame.go
Fix an error in Charofpt function where it was failing to advance
through the box model.
DrawText is not part of the public API so rename to drawtext.
This is an incomplete patch for selection drawing both the
implementation and exposing the functionality in the demo.
In progress code to draw selections properly.
A series of changes to accomplish the following:

* get Drawsel0 to correctly draw a specified selection highlight if
none is currently applied.

* get Drawsel to correctly update both the tick and selection
highlight regardless of the state of the tick or selection highlight.

* extend the framedemo to show that selections work properly in both
directions.

This version of Drawsel may not be semantically equivalent to the one
found in the C code. In particular: the way that selection range is
both used and adjusted from outside and inside of Frame is undesirable
in a Go context so I attempted to alter the semantics in a reasonable
way.
Minor bug fixes to support resizing the frame. In particular Clear now
correctly resets state so that Insert will work afterwards.
Make the demo window resizable. Show that resizing works correctly.
Charofpt had bug causing incorrect selection drawing behaviour. Fix
this and add a unittest.
Cleaned up logging in draw.go. It was a bit too verbose.
Added some extra debugging logs to framedemo for finding selection
issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants