Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for wxwidgets 2.9.x #89

Closed
pkulchenko opened this issue Dec 14, 2012 · 53 comments
Closed

Add compatibility for wxwidgets 2.9.x #89

pkulchenko opened this issue Dec 14, 2012 · 53 comments
Assignees
Milestone

Comments

@pkulchenko
Copy link
Owner

Fixed issues

  • (fixed) files are returned as file:/D%3a/users/..., which creates several problems: (1) file:/ prefix needs to be removed, (2) %xx need to be decoded, and (3) the path needs to be normalized for native processing (or any separator dependent code needs to be updated); also FindFirst and FindNext functions now return full path where the relative path was returned (in 2.8.x)
  • (fixed) folder selection doesn't work because of what seems to be an issue with wxDirDialog on Windows: when a folder is selected with a double click and up the hierarchy, then the same name is shown in the "folder" text field and is returned as part of the name, such that if you select folder "foo", you get "foo/foo".
  • (fixed) function dropdown is too narrow
  • (not an issue) the configuration file ZeroBraneStudio.ini is saved in C:\Users\<user>\AppData\Roaming\.
  • (fixed) About dialog is incorrectly formatted (Windows and OSX, 2.9.4)
  • (fixed) folds are missing (all platforms; 2.9.5)
  • (fixed switching to "default" toolbar) toolbar color is too dark (OSX, 2.9.4+)
  • (fixed) backspace is slow (works fine in original wxSTC); fixed by removing SetStatusText from UPDATEUI event
  • (fixed) pressed icon color on toolbar is inverted incorrectly (OSX, 2.9.4+); need to provide an appropriate image?
  • (fixed) function dropdown is missing (OSX, 2.9.4+)
  • (fixed with workaround; known issue) full screen mode doesn't hide toolbar and statusbar (OSX, 2.9.5)
  • (fixed) rearranging the editor tabs with drag and drop. This seems to break a mapping between the visual order of editor tabs and the array of opened documents. Try to open two documents, swap them by dragging one editor tab onto another and type smth in the active document. The another tab (i.e. inactive one) will be wrongly updated.
  • (fixed) default font size is too small (OSX, 2.9.5)
  • (fixed; wxwidgets issue) menu hint is not cleared from the statusbar (OSX, 2.9.5)
  • (fixed; wxwidgets issue) cursor doesn't change shape to left-right arrow in scratchpad on OSX; EVT_SET_CURSOR event is not triggered
  • (fixed; wxwidgets issue) editor doesn't accept numpad keys
  • (fixed) multi-line paste into console windows moves the indicator incorrectly (Windows and OSX); appears to be a feature, but needs a workaround.
  • (fixed; wxwidgets issue) switching tabs doesn't set focus to the associated editor (OSX, 2.9.5)
  • (fixed with workaround by e4a69a6; properly fixed by aa2a4fa) crash is reported on OSX when ZBS is closed while debugging is in progress. It was hakishly fixed (ced9908) for 2.8.12, but the fix didn't help with 2.9.5
  • (fixed with workaround by 14143bf; wxwidgets issue) always shows "Jump to a function definition..." and never gets updated. It seems like neither wxEVT_SET_FOCUS nor wxEVT_LEFT_DOWN is triggered (Linux, 2.9.5)
  • (fixed with workaround) GotoPos or SetCurrentPos with EnsureCaretVisible don't make the caret visible (Reopened tabs don't center the editor view correctly #116).
  • (fixed) Closing editor tab on Linux keeps the tabbar active instead of switching focus to the editor; requires a click on the editor itself.
  • (fixed) Ctrl-T swaps two lines in the editor instead of activating tooltip (CTRL+T on Linux moves up the current line #118)
  • (fixed with workaround; wxwidgets issue) Pressing Enter doesn't activate Find Next in Find/Replace dialog on OSX; removed SetDefault to make Find activated by Cmd-F
  • (fixed by drawing from 0 to 360 instead of from 0 to 0) DrawEllipticArc doesn't draw anything on OSX.
  • (fixed by aa2a4fa) the app seg faults on Linux if quit less than 2 seconds after running a process:
#0  0xb74ae780 in typeinfo name for wxObject () from bin/linux/x86/libwx.so
#1  0xb735998b in wxEvtHandler::Unlink() () from bin/linux/x86/libwx.so
#2  0xb735a7da in wxEvtHandler::~wxEvtHandler() () from bin/linux/x86/libwx.so
#3  0xb73205ff in wxProcess::~wxProcess() () from bin/linux/x86/libwx.so
#4  0xb6fd1e30 in wxLua_wxProcess_delete_function(void**) () from bin/linux/x86/libwx.so
#5  0xb708ae54 in wxluaO_deletegcobject(lua_State*, int, int) () from bin/linux/x86/libwx.so
#6  0xb707eeed in wxlua_wxLuaBindClass__gc(lua_State*) () from bin/linux/x86/libwx.so

Known and not yet fixed issues

  • build/CMakefile needs to be updated to work with new linux configuration
  • (wxwidgets issue) artifacts remain on the screen (only noticed on some hackintosh/OSX installs); workaround: moving the project pane to the right side or undocking it; can't confirm anymore (after Apr 28th 2013)
  • (wxwidgets issue) tab not clickable after tab move; workaround: clicking on any other tab.
  • Confirmation dialogs are missing application icons (on OSX) and instead display a generic app icon.
  • FloodFill doesn't fill anything on OSX

Linux support

Tested on Ubuntu 10.04, Ubuntu 12.04, ArchLinux, Fedora 18 (32/64bit); seen working on Xubuntu 12.10, Gentoo, and Mint.

@ghost ghost assigned pkulchenko Dec 14, 2012
pkulchenko added a commit that referenced this issue Dec 14, 2012
wxwidgets 2.9.x in some cases returns the last segment of the path twice
(at least on Windows), which makes the entire path invalid.
@pkulchenko
Copy link
Owner Author

@Toiffel, thanks for the binaries. You should be able to run the current version using wxwidgets 2.9.x. I suggest you rebase with the current HEAD as you won't have any conflicts. Please post here any issues you notice and I'll update the ticket. The changes have only been tested on Windows so far.

@kodemeister
Copy link
Contributor

My $0.02. These issues may or may not be 2.9.x-specific; I just put them all together.

  • Code folding doesn't work anymore. Fold markers are not appearing on the left panel and Edit - Fold/Unfold All seems to do nothing.
  • On Linux ZBS always crashes with segfault upon exit for unknown reason.
  • Recent files list can have duplicate entries. For example, open file test.lua, then test2.lua and finally test.lua again. You'll get two duplicate test.lua entries.
  • ZBS shows the following error message while trying to open a non-existent file from the recent files list:
    Lua: Error while running chunk
    src/editor/commands.lua:102: bad argument #1 to 'find' (string expected, got nil)
  • Tooltips aren't shown if there are some whitespaces between the function name and left parenthesis. For example, this works: print("Hello world") but this doesn't: print ("Hello world").

@pkulchenko
Copy link
Owner Author

Recent files list can have duplicate entries. For example, open file test.lua, then test2.lua and finally test.lua again. You'll get two duplicate test.lua entries.
ZBS shows the following error message while trying to open a non-existent file from the recent files list: Lua: Error while running chunk src/editor/commands.lua:102: bad argument #1 to 'find' (string expected, got nil)
Tooltips aren't shown if there are some whitespaces between the function name and left parenthesis. For example, this works: print("Hello world") but this doesn't: print ("Hello world")

These are not 2.9.x issues. They are reproducible in the current version. Will fix. Recent files need to be re-done as they are inefficiently managed.

Code folding doesn't work anymore.

This is serious. I'll need to check if the samples are working. Maybe it's just an API change...

Linux crash is also serious. I've seen something similar on OSX with 2.9.3 and added this check at the end of CloseWindow function:

  -- without explicit exit() the IDE crashes with SIGILL exception when closed
  -- on MacOS compiled under 64bit with wxwidgets 2.9.3
  if ide.osname == "Macintosh" then os.exit() end

Can you enable it for Linux and see if this fixes an issue? What's the stack trace from the crash?

@kodemeister
Copy link
Contributor

Yes, os.exit() fixes (hides?) the issue. I'll need to make a debug build to obtain more information about the crash. Maybe there is a better way to solve it.

@pkulchenko
Copy link
Owner Author

I checked the samples that come with wxlua and they also don't have folding (on Windows, using 2.9.5). Just in case the version of Scintilla that comes with 2.9.5 is 3.21. The version that comes with 2.9.4 is much older one (2.03).

This may be a relevant ticket, although it should be fixed in 2.9.5. The strange thing is that it's not just markers: folding all/some doesn't work either.

@kodemeister
Copy link
Contributor

You're right, folding had stopped working exactly after 2.9.4 -> 2.9.5 transition. However API doesn't seem to have changed, at least on wxLua side. Maybe newer versions of Scintilla have some additional properties to set? (like editor:SetProperty("fold", "1"))

BTW I fixed the second issue with crashes on exit both for OS X and Linux. They were caused by missing wxAuiManager::UnInit() which should always be called before a managed frame is destroyed. Please check this commit and cherry-pick it if it works for you.

@pkulchenko
Copy link
Owner Author

Good catch on AuiManager::UnInit()! I'll get the commit into the current master branch.

The situation with folds is interesting. If you run GetEditor():GetFoldLevel(<linenum>) in the console with <linenum> being something with a fold in 2.8.12, you'll see a number >1024 (1024 will be shown on a line without fold). If you run the same command in 2.9.5, you will get 1024; so it looks like it doesn't even try to recognize the fold (and as such doesn't draw them and doesn't fold/unfold them). I hope it's a matter of some API changes, but I can't find them in the docs. I can't find any fold related issues in Scintilla bug tracking either. Very puzzling...

@pkulchenko
Copy link
Owner Author

Here is a minimal example with folds that works in 2.8.x, but doesn't work in 2.9.5:

require "wx"
local frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "STC Demo",
  wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE )
local e = wxstc.wxStyledTextCtrl(frame, wx.wxID_ANY,
  wx.wxDefaultPosition, wx.wxSize(0, 0), wx.wxBORDER_STATIC)
e:SetText("if true then\n  print('123')\nend\n\nfoo(1,\n  2)\n")

e:SetMarginType(0, wxstc.wxSTC_MARGIN_SYMBOL)
e:SetMarginWidth(0, 15)
e:SetMarginMask(0, wxstc.wxSTC_MASK_FOLDERS)
e:SetMarginWidth(1, 0)

local w, b = wx.wxColour(255, 255, 255), wx.wxColour(0, 0, 0)
e:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDERTAIL, wxstc.wxSTC_MARK_LCORNER, w, b)
e:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDERSUB,  wxstc.wxSTC_MARK_VLINE, w, b)
e:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDEROPEN, wxstc.wxSTC_MARK_BOXMINUS, w, b)

e:SetProperty("fold", "1")
e:SetLexer(wxstc.wxSTC_LEX_LUA) --<-- this needs to be moved before SetProperty to work
e:SetKeyWords(0, "if then end do")

frame:Show(true)
wx.wxGetApp():MainLoop()

Also, I checked SciTE based on the same version of Scintilla (3.2.1) and the folds are working there. So it seems to be something on the wxwidgets side.

@pkulchenko
Copy link
Owner Author

Few more pieces of information. The second example on this page doesn't show folds when compiled with 2.9.5, but the sample that comes with wxwidgets (samples/stc) does show folds (in the regular and minimal editor).

@pkulchenko
Copy link
Owner Author

Ok, I figured the issue: SetLexer needs to be called before SetProperty("fold", "1"):

e:SetLexer(wxstc.wxSTC_LEX_LUA)
e:SetProperty("fold", "1")

I guess it didn't matter with earlier versions, but seems to matter now... I'll restructure the code to take that into account.

@kodemeister
Copy link
Contributor

Well done! I'd never think the order of calls does matter.

One small addition to the issue with function list dropdown. On Linux (using wxWidgets 2.9.5) it always shows "Jump to a function definition..." and never gets updated. It seems like neither wxEVT_SET_FOCUS nor wxEVT_LEFT_DOWN is triggered.

@pkulchenko
Copy link
Owner Author

@Toiffel, thank you for the heads up on the Linux issue; haven't had a chance to test there yet. I'll push a new 2.9 branch shortly as it includes some incompatible changes that need to be tested. The fold changes and your fix has been included and pushed.

@kodemeister
Copy link
Contributor

Updated, thanks. Code folding now works properly. BTW, if you need to test 2.9.5 on Linux, you may want to check this commit. I modified package.cpath handling in src/main.lua to load libwx.so from 'bin' directory (like on Windows and OS X). Feel free to copy any changes you'll need.

@pkulchenko
Copy link
Owner Author

Arthur, I'm working on putting 2.9.5-related changes into a new branch and would like to merge your changes including the binaries. Is mingw a good branch to merge? Do you need to do any cleanup/rebase there?

Also, do you plan to put Linux binaries there too? Since we're switching to 2.9.x, it would be useful to include Linux binaries (in the same way we do for OSX/Windows); we just need to make sure that they are built against the oldest libc we want to support. Could be 2.11.1-0 to support Ubuntu 10.4 and up or 2.11.3-4 to support Debian Squeeze and up. It seems like going with 2.11.1-0 would be the safest bet and gives us the most coverage in terms of Linux versions.

@kodemeister
Copy link
Contributor

Okay, I've prepared mingw branch for merging. Note that zbstudio.exe has been rebuilt from scratch and contains only small 32x32 icon. I suggest you to put a multi-size ZBS icon into zbstudio/res directory and specify the icon name in zbstudio/res/zbstudio.rc. This way the icon will be compiled into zbstudio.exe automatically.

As for Linux, I wouldn't provide libwx.so within the source distribution. Instead of this I'd include libwx.so only to deb packages. Users of other distros can always build their own libwx.so via build-linux.sh (or just install an older wxLua/wxWidgets 2.8.12 from repos if you'll keep the backward compability).

pkulchenko added a commit that referenced this issue Feb 25, 2013
…#89).

Removed Cut/Copy/Paste/Undo/Redo icons from the toolbar as these are
rarely used and were taking too much space.
@pkulchenko
Copy link
Owner Author

@Toiffel, thanks for the updates in the mingw branch! I merged all the changes and committed several changes on top to fix several issues on OSX (including the menus and the dropdown); everything is in the wxwidgets branch. I also enabled some of the new features (like multiple selection and multi-cursor editing; use Ctrl-Click or Ctrl-Select to activate).

I updated the first post in this ticket with the list of current issues; will be working on OSX ones tomorrow. I switched to "native" toolbar on OSX, but it requires 24px icons that I haven't updated yet (I mostly copied 16px icons into 24px ones).

Also, live coding doesn't work with wxwidgets apps because of wxlua fix that I apply, which is not included in your binaries. I'll update the build scripts and binaries with the fix in few days. Everything else looks good so far. Please let me know and update the ticket if you find any new issues. Thanks!

@kodemeister
Copy link
Contributor

Nice progress, Paul:) I've just found an another 2.9.x bug related to rearranging the editor tabs with drag and drop. This seems to break a mapping between the visual order of editor tabs and the array of opened documents. Try to open two documents, swap them by dragging one editor tab onto another and type smth in the active document. The another tab (i.e. inactive one) will be wrongly updated.

@pkulchenko
Copy link
Owner Author

I agree; It wouldn't be my preference (and I'm looking at using wxComboBox instead of wxChoice on Linux), but the main reason being is to give a larger audience a chance to test new binaries before the next release.

I'll take a stub at fixing the wxChoice issue before the merge...

@pkulchenko
Copy link
Owner Author

@Toiffel, take a look; wxChoice issue should be fixed ;).

@pkulchenko
Copy link
Owner Author

Hi Arthur, have you noticed any segfaults on Linux when exiting the IDE? You may need to remove & from zbstudio.sh to see them. I see them intermittently, but quite regularly (just start the IDE and exit it after few seconds). Adding os.exit() to CloseWindow fixes the issue for me. The stack shows the crash coming from wxlua internal code called from inside the garbage collector, so I'm not sure what to do about it (other than adding os.exit()). I don't see this happening anywhere else, but happens on both 32bit and 64bit Linux (on older builds too, so not related to libpng work).

pkulchenko added a commit that referenced this issue Mar 22, 2013
The builtin library is now using separate symbols to avoid conflicts with
system libpng.
@pkulchenko
Copy link
Owner Author

I added a workaround for the crash and it seems to be completely gone, but I don't like that the workaround is even needed: a26d72f.

pkulchenko added a commit that referenced this issue Mar 29, 2013
…(ref #89).

On Windows multiple COMBOBOX_SELECTED events are sent when Enter is used,
which may lead to run-time errors. Disabled processing of multiple copies
of the same event.
pkulchenko added a commit that referenced this issue Apr 11, 2013
This is caused by two PAGE_CHANGED event for the notebook triggered
when the current tab is not the last one (in wx2.9.5+). This could lead to
a crash if the incorrect tab is closed (ref #89).
pkulchenko added a commit that referenced this issue Jun 4, 2014
pkulchenko added a commit that referenced this issue Jun 6, 2014
…327).

This is a more complete workaround for missing KILL_FOCUS event on OSX (an
incomplete workaround was removed by a315b1a).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants