History log of /haiku/src/kits/interface/textview_support/TextGapBuffer.h
Revision Date Author Comments
# 3c857341 31-Dec-2015 Augustin Cavalier <waddlesplash@gmail.com>

BTextView: Don't crash if the file supplied is zero-length.

Fixes #12551.


# 7e31a05c 09-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

Close #6435:
* fix problem in TextGapBuffer which could lead to data loss at end of buffer
when deleting large chunks of text


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c3423856 09-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* style cleanup - no functional change

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37984 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2272ecea 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

zooey+mmlr:
* Ensure that there is still buffer left when 0-terminating the buffer in
RealText().
* Remove the fExtraCount member and instead make it into a constant as that's
how it's used and more obvious.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36306 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c4e7641 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

zooey+mmlr:
* Large cleanup in _FindLineBreak(), be a bit more clever by storing the found
offsets instead of calculating them multiple times, use
_TabExpandedStyledWidth() instead of _StyledWidth() and manual tab calculation
which was also broken (it assumed tabs were consequtive which was possibly not
the case).
* Modified CanEndLine() to also return true when going from non-whitespace to
whitespace and the other way around which is more logical (so we'd break after
the word and not after word + whitespace, even though we actually do that
in the end by eating whitespace after words in _FindLineBreak()).
* The TextGapBuffer is not necessarily 0 terminated, so RealCharAt() needs to
check if the index is at the end of the string and return 0 in that case.
Before it would access the buffer "out by one" which could've lead to a crash.
* Simplified the gap moving calculations by removing some no-op calculations.
* Added debugger calls in TextGapBuffer in case of invalid use.
* Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36304 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec7d1680 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Automatic whitespace cleanup, no functional change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36301 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 90b7764d 21-Sep-2008 Rene Gollent <anevilyak@gmail.com>

Move WidthBuffer and TextGapBuffer into BPrivate and use them from there in BPoseView and BTextView. This (correctly) fixes the previous gcc4 build issues.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27675 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a682d981 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Quite a cleanup action to avoid polluting the global namespace with private
BTextView classes:

* Declared the directly used BTextView helper classes as private BTextView
classes and changed all affected files.
* Realized that Tracker's BPoseView was (accidentally?) using what used to
be _BWidthBuffer_. It had declared it's own class with the same name and
same members/size in headers/private/tracker/TextViewSupport.h, but the
implementation was nowhere to be found. I can only explain this that
the BTextView implementation was then actually linked and used. But the big
problem was that it was used without locking (unlike in BTextView)! When
many Tracker windows opened during system startup or later and they happened
to each request characters not yet in the cache, I imagine things could have
gone bad and corrupted memory. Anyways, since I can see the usefulness of
the cache, BPoseView uses BTextView::WidthBuffer on purpose now. And I moved
the locking inside BTextView::WidthBuffer::StringWidth().
* Adjusted InterfaceDefs.cpp accordingly.
* TODO: Move subsequent classes into BTextView namespace as well, ie derived
classes that BTextView doesn't directly know about. All stuff in src/kits/
inteface/textview_support/
* Added preliminary and not yet implemented layout friendly BTextView
constructors.
* I will try to handle the insets imposed by BTextView::fTextRect a bit
differently when used inside the new layout management framework. For this,
I added BTextView::SetInsets() and GetInsets(). SetInsets() doesn't do
anything yet.

So far, everything seems to work still... ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27654 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e94ad1e2 31-Aug-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

If typing is hidden, don't reply to B_COPY or B_CUT messages, but beep()
in this case. Note that the public methods still let you copy and cut
the real text. Also prevented stealing passwords via scripting (not
tested, though). Fixes bug #1354
Got rid of the _BTextGapBuffer_::[] operator since using it creates less readable code.
Also Implemented _BTextGapBuffer_::RealText() and used it instead of Text() inside BTextView. Will make sense later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22129 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de20f0fa 01-Oct-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

some changes, fixed a rendering bug

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 25ba188a 27-Sep-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

added a parameter to _BTextGapBuffer_::GetString() so that the caller knows how many bytes are really returned. password mode looks better now

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18965 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b31b14e0 28-Aug-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Renamed BTextView folder to textview_support


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18663 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7e31a05ca501754c1be178dd167bd4f37170d0ae 09-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

Close #6435:
* fix problem in TextGapBuffer which could lead to data loss at end of buffer
when deleting large chunks of text


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c34238562be48b7c02339898eb34bce45a10eb17 09-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* style cleanup - no functional change

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37984 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2272ecea2647f43104a26bdc03bdd0ae48515d84 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

zooey+mmlr:
* Ensure that there is still buffer left when 0-terminating the buffer in
RealText().
* Remove the fExtraCount member and instead make it into a constant as that's
how it's used and more obvious.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36306 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c4e7641a732891a776f88c3c46b237de9220f88 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

zooey+mmlr:
* Large cleanup in _FindLineBreak(), be a bit more clever by storing the found
offsets instead of calculating them multiple times, use
_TabExpandedStyledWidth() instead of _StyledWidth() and manual tab calculation
which was also broken (it assumed tabs were consequtive which was possibly not
the case).
* Modified CanEndLine() to also return true when going from non-whitespace to
whitespace and the other way around which is more logical (so we'd break after
the word and not after word + whitespace, even though we actually do that
in the end by eating whitespace after words in _FindLineBreak()).
* The TextGapBuffer is not necessarily 0 terminated, so RealCharAt() needs to
check if the index is at the end of the string and return 0 in that case.
Before it would access the buffer "out by one" which could've lead to a crash.
* Simplified the gap moving calculations by removing some no-op calculations.
* Added debugger calls in TextGapBuffer in case of invalid use.
* Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36304 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec7d16808176099e6cdac7c0780e2d0946ba0236 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Automatic whitespace cleanup, no functional change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36301 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 90b7764dc354ff1bcb01abf78dafe16faa820725 21-Sep-2008 Rene Gollent <anevilyak@gmail.com>

Move WidthBuffer and TextGapBuffer into BPrivate and use them from there in BPoseView and BTextView. This (correctly) fixes the previous gcc4 build issues.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27675 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a682d9819fae1e26cef1390bb33b5d5c73304642 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Quite a cleanup action to avoid polluting the global namespace with private
BTextView classes:

* Declared the directly used BTextView helper classes as private BTextView
classes and changed all affected files.
* Realized that Tracker's BPoseView was (accidentally?) using what used to
be _BWidthBuffer_. It had declared it's own class with the same name and
same members/size in headers/private/tracker/TextViewSupport.h, but the
implementation was nowhere to be found. I can only explain this that
the BTextView implementation was then actually linked and used. But the big
problem was that it was used without locking (unlike in BTextView)! When
many Tracker windows opened during system startup or later and they happened
to each request characters not yet in the cache, I imagine things could have
gone bad and corrupted memory. Anyways, since I can see the usefulness of
the cache, BPoseView uses BTextView::WidthBuffer on purpose now. And I moved
the locking inside BTextView::WidthBuffer::StringWidth().
* Adjusted InterfaceDefs.cpp accordingly.
* TODO: Move subsequent classes into BTextView namespace as well, ie derived
classes that BTextView doesn't directly know about. All stuff in src/kits/
inteface/textview_support/
* Added preliminary and not yet implemented layout friendly BTextView
constructors.
* I will try to handle the insets imposed by BTextView::fTextRect a bit
differently when used inside the new layout management framework. For this,
I added BTextView::SetInsets() and GetInsets(). SetInsets() doesn't do
anything yet.

So far, everything seems to work still... ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27654 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e94ad1e24d1fafa275a99a7edad869d2a1a825d4 31-Aug-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

If typing is hidden, don't reply to B_COPY or B_CUT messages, but beep()
in this case. Note that the public methods still let you copy and cut
the real text. Also prevented stealing passwords via scripting (not
tested, though). Fixes bug #1354
Got rid of the _BTextGapBuffer_::[] operator since using it creates less readable code.
Also Implemented _BTextGapBuffer_::RealText() and used it instead of Text() inside BTextView. Will make sense later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22129 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de20f0facaa2afcc46cde051e683bd65af8e3f84 01-Oct-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

some changes, fixed a rendering bug

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 25ba188a07355107b2da915d49d8c21308511cb6 27-Sep-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

added a parameter to _BTextGapBuffer_::GetString() so that the caller knows how many bytes are really returned. password mode looks better now

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18965 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b31b14e033ffc2c4850235821c9390a151abd2c9 28-Aug-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Renamed BTextView folder to textview_support


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18663 a95241bf-73f2-0310-859d-f6bbb57e9c96