Coder Social home page Coder Social logo

Error in/around InsertNewLine about e HOT 18 CLOSED

etexteditor avatar etexteditor commented on July 28, 2024
Error in/around InsertNewLine

from e.

Comments (18)

erwilliams avatar erwilliams commented on July 28, 2024

Ok, so that formatting was easier than expected.
Here are the sequences I've tried and their results. | indicated cursor position.
// Original example
if (something)
{|} // was auto-indented here
Enter => Error

if (something) {|}
Enter => Error

// # = any character
if (something) {#|}
Enter =>
if (something) {#
    |
}

if (something) {|}
if (something) {}|    // Move cursor anywhere
if (something) {|}    // Move cursor back
Enter =>
if (something) {
    |
}

from e.

adamv avatar adamv commented on July 28, 2024

Just tried this on my build; typed the first two lines of the original example above, then pressing '{' gave me an assert within the binary-only core library.

The last line I have source for is Document.cpp, line 310 "m_textData.GetTextPart() in Document::TextPart."

from e.

astigsen avatar astigsen commented on July 28, 2024

Could you try this with the latest master (build with wxwidgets 2.8.10)? I don't seem to be able to reproduce it here.

Are you writing the PHP code within a HTML document (with HTML as the selected syntax)?

from e.

peol avatar peol commented on July 28, 2024

I'm still crashing, built on Vista x64 with wxWidgets 2.8.10. It crashes in any programming language bundle (I'm using JavaScript), if (something) {} still crashes, deleting the right one and adding it again and pressing works. It only seems to be when it is autocompleting the curly braces.

from e.

peol avatar peol commented on July 28, 2024

My |ENTER| tags disappeared (I guess it thought it was an HTML element, silly me).
"[...] if (something) {|ENTER|}"
"[...] adding it again and pressing |ENTER| works"

from e.

adamv avatar adamv commented on July 28, 2024

Entering this on XP3 (32) w/ 2.8.10 still crashes e. New document, select PHP:
// Original example
if (something)
{

On typing the { I get an assertion failure.

from e.

astigsen avatar astigsen commented on July 28, 2024

Weird, I am still not able to reproduce it (I am on Vista (32)).

@adamv: Did the assert in the core library give any output?

from e.

peol avatar peol commented on July 28, 2024

I had it working for a second yesterday, but now I'm back with crashes again. It doesn't seem to be curly bracers only though, in at least JavaScript [] also breaks e with the same error message.

from e.

astigsen avatar astigsen commented on July 28, 2024

Could you give me the exact text of the error message? I would really like to track this down, but as I can't reproduce it on my setup, I will need as much info as possible from those of you who experience it.

from e.

adamv avatar adamv commented on July 28, 2024

c:\dev\ecore\cdatatext.cpp(90): assert "utf8_len(buffer[b] == len - b" failed in cDataText::GetTextPart().

call stack:
...
[06] Document::GetTextPart document.cpp:310
Styler_Syntax::DoSearch styler_syntax:464
Styler_Syntax::Insert styler_syntax:955
EditorCtrl::StylersInsert editorctrl.cpp:2860
and some more lines up through [20] GetDC.

from e.

adamv avatar adamv commented on July 28, 2024

http://www.flickr.com/photos/adamvandenberg/3531770585/

from e.

astigsen avatar astigsen commented on July 28, 2024

The assert indicates that the range of text requested by GetTextPart ends in the middle of an uncomplete utf-8 sequence. Since there is nothing above the ascii range in the sample, it seems like some garbage memory is at some point above getting written into the document. This could also be why I can't reproduce is (it may depend on memory layout).

It would be very helpful if you could step through EditorCtrl::InsertChar before the assert happens, and see what gets inserted. The problem seems to be associated with indentation changes, so it might be useful to keep an eye on the variable m_indent (which contains the current indentation unit).

Could you also tell me what your current indentation settings are?

from e.

peol avatar peol commented on July 28, 2024

I leave the debugging to adamv, I don't know what the hell I'm doing. :-) I actually thought about the indentation earlier, I'm using a custom "two spaces represents tab" and the document encoding's I'm using varies between ISO-8859-1 and UTF-8 (mainly UTF-8 though)

from e.

adamv avatar adamv commented on July 28, 2024

I'm set to Soft Tabs, 4, default (Windows 1252), CRLF

from e.

adamv avatar adamv commented on July 28, 2024

(Also, I have to set the new document to PHP before typing, or it doesn't repro.)

On line 2264 there's a doc.Insert(linestart=35, indent=string containing 4 spaces)
This returns an indent_len of 4
Line 2266: m_lines.Insert(linestart=35, indent_len=4)
Then I step into EditorCtrl::StylersInsert

Inside Styler_Syntax::Insert(pos=35, length=4)
docLen = 41

Get down to Styler_Syntax:DoSearch(start=35, end=41, limit=41)
Line 463, doc.GetTextPart(si.lineStart=35, si.lineEnd=42, si.line=empty vector

Get into Document::GetTextPart.
Calls m_textData.GetTextPart(start_pos=35, end_pos=41, buffptr = resized to 6 characters)

At that point I don't have source code, and the assertion happens.

from e.

astigsen avatar astigsen commented on July 28, 2024

Thanks to those of you who sent me further info. I have located the problem, and it is a bug in the metakit library. I should have a fix out shortly.

from e.

peol avatar peol commented on July 28, 2024

Awesome, looking forward to try it out!

from e.

astigsen avatar astigsen commented on July 28, 2024

Fixed bug in metakit that garbled insertions. Closed by 2d0178b

from e.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.