Commit MetaInfo

Revision5286f17bd78ce5a66023cff4f014a973d5433459 (tree)
Time2017-08-18 14:25:32
Author <exeal@user...>

Log Message

.

Change Summary

Incremental Difference

diff -r 466d227e850f -r 5286f17bd78c ascension/ascension/kernel/locations.hpp
--- a/ascension/ascension/kernel/locations.hpp Fri Aug 18 01:39:38 2017 +0900
+++ b/ascension/ascension/kernel/locations.hpp Fri Aug 18 14:25:32 2017 +0900
@@ -2,7 +2,7 @@
22 * @file locations.hpp
33 * Defines @c ascension#kernel#locations namespace.
44 * @author exeal
5- * @see viewer/locations.hpp
5+ * @see viewer/visual-locations.hpp
66 * @date 2003-2015 Was document.hpp.
77 * @date 2016-05-22 Separated from document.hpp.
88 */
@@ -35,7 +35,10 @@
3535 GLYPH_CLUSTER ///< A glyph is a character (not implemented).
3636 };
3737
38- /// Describes a position in the document.
38+ /**
39+ * Describes a position in the document.
40+ * @see viewer#locations#PointProxy
41+ */
3942 typedef std::pair<const Document&, Position> PointProxy;
4043
4144 /**
@@ -49,6 +52,7 @@
4952 }
5053
5154 /// @defgroup special_locations_in_document Special Locations in Document
55+ /// Free functions related to special locations.
5256 /// @note All functions are *affected* by accessible region of the document.
5357 /// @{
5458 Position beginningOfDocument(const PointProxy& p);
@@ -72,6 +76,7 @@
7276 /// @}
7377
7478 /// @defgroup regions_of_document Regions of Document
79+ /// Free functions related to document's region.
7580 /// @{
7681 bool isOutsideOfDocumentRegion(const PointProxy& p) BOOST_NOEXCEPT;
7782 Position shrinkToDocumentRegion(const PointProxy& p) BOOST_NOEXCEPT;
@@ -79,6 +84,7 @@
7984 /// @}
8085
8186 /// @defgroup accessible_regions_of_document Accessible Regions of Document
87+ /// Free functions related to document's accessible region.
8288 /// @{
8389 // bool isOutsideOfAccessibleRegion(const PointProxy& p) BOOST_NOEXCEPT;
8490 Position shrinkToAccessibleRegion(const PointProxy& p) BOOST_NOEXCEPT;
diff -r 466d227e850f -r 5286f17bd78c ascension/ascension/viewer/visual-locations.hpp
--- a/ascension/ascension/viewer/visual-locations.hpp Fri Aug 18 01:39:38 2017 +0900
+++ b/ascension/ascension/viewer/visual-locations.hpp Fri Aug 18 14:25:32 2017 +0900
@@ -30,18 +30,16 @@
3030 * @see kernel#locations
3131 */
3232 namespace locations {
33+ /**
34+ * Describes a position in the @c TextArea.
35+ * @see kernel#locations#PointProxy
36+ */
3337 typedef std::pair<const TextArea&, TextHit> PointProxy;
3438
35- bool isEndOfVisualLine(const PointProxy& p);
36- bool isFirstPrintableCharacterOfLine(const PointProxy& p);
37- bool isFirstPrintableCharacterOfVisualLine(const PointProxy& p);
38- bool isLastPrintableCharacterOfLine(const PointProxy& p);
39- bool isLastPrintableCharacterOfVisualLine(const PointProxy& p);
40- bool isBeginningOfVisualLine(const PointProxy& p);
41-#ifdef ASCENSION_ABANDONED_AT_VERSION_08
42- viewer::VisualDestinationProxy backwardPage(const PointProxy& p, Index pages = 1);
43- viewer::VisualDestinationProxy backwardVisualLine(const PointProxy& p, Index lines = 1);
44-#endif // ASCENSION_ABANDONED_AT_VERSION_08
39+ /// @defgroup special_locations_in_text_area Special Locations in Text Area
40+ /// Free functions related to special locations in @c TextArea.
41+ /// @note All functions are *affected* by accessible region of the document.
42+ /// @{
4543 TextHit beginningOfVisualLine(const PointProxy& p);
4644 TextHit contextualBeginningOfLine(const PointProxy& p);
4745 TextHit contextualBeginningOfVisualLine(const PointProxy& p);
@@ -50,24 +48,39 @@
5048 TextHit endOfVisualLine(const PointProxy& p);
5149 TextHit firstPrintableCharacterOfLine(const PointProxy& p);
5250 TextHit firstPrintableCharacterOfVisualLine(const PointProxy& p);
51+ bool isEndOfVisualLine(const PointProxy& p);
52+ bool isFirstPrintableCharacterOfLine(const PointProxy& p);
53+ bool isFirstPrintableCharacterOfVisualLine(const PointProxy& p);
54+ bool isLastPrintableCharacterOfLine(const PointProxy& p);
55+ bool isLastPrintableCharacterOfVisualLine(const PointProxy& p);
56+ bool isBeginningOfVisualLine(const PointProxy& p);
57+ TextHit lastPrintableCharacterOfLine(const PointProxy& p);
58+ TextHit lastPrintableCharacterOfVisualLine(const PointProxy& p);
59+ /// @}
60+
5361 #ifdef ASCENSION_ABANDONED_AT_VERSION_08
62+ /// @defgroup motions_in_text_area Motions in Text Area
63+ /// @note All functions are *affected* by accessible region of the document.
64+ /// @{
65+ viewer::VisualDestinationProxy backwardPage(const PointProxy& p, Index pages = 1);
66+ viewer::VisualDestinationProxy backwardVisualLine(const PointProxy& p, Index lines = 1);
5467 viewer::VisualDestinationProxy forwardPage(const PointProxy& p, Index pages = 1);
5568 viewer::VisualDestinationProxy forwardVisualLine(const PointProxy& p, Index lines = 1);
56-#endif // ASCENSION_ABANDONED_AT_VERSION_08
57- TextHit lastPrintableCharacterOfLine(const PointProxy& p);
58- TextHit lastPrintableCharacterOfVisualLine(const PointProxy& p);
59-#ifdef ASCENSION_ABANDONED_AT_VERSION_08
6069 viewer::VisualDestinationProxy leftCharacter(
6170 const PointProxy& p, CharacterUnit unit, Index characters = 1);
6271 boost::optional<TextHit> leftWord(const PointProxy& p, Index words = 1);
6372 boost::optional<TextHit> leftWordEnd(const PointProxy& p, Index words = 1);
64-#endif // ASCENSION_ABANDONED_AT_VERSION_08
65-#ifdef ASCENSION_ABANDONED_AT_VERSION_08
6673 viewer::VisualDestinationProxy rightCharacter(
6774 const VisualPoint& p, CharacterUnit unit, Index characters = 1);
6875 boost::optional<Position> rightWord(const PointProxy& p, Index words = 1);
6976 boost::optional<Position> rightWordEnd(const PointProxy& p, Index words = 1);
77+ /// @}
7078 #endif // ASCENSION_ABANDONED_AT_VERSION_08
79+
80+ /// @defgroup miscellaneous_visual_locational_functions Miscellaneous Visual Locational Functions
81+ /// @{
82+ TextHit updateTextHit(const TextHit& position, const kernel::DocumentChange& change, Direction gravity) BOOST_NOEXCEPT;
83+ /// @}
7184 }
7285 }
7386 }
diff -r 466d227e850f -r 5286f17bd78c ascension/ascension/viewer/visual-point.hpp
--- a/ascension/ascension/viewer/visual-point.hpp Fri Aug 18 01:39:38 2017 +0900
+++ b/ascension/ascension/viewer/visual-point.hpp Fri Aug 18 14:25:32 2017 +0900
@@ -37,8 +37,11 @@
3737 TextHit otherHit(const VisualPoint& p);
3838
3939 namespace locations {
40+ /// @addtogroup motions_in_text_area Motions in Text Area
41+ /// @{
4042 VisualDestinationProxy nextPage(const VisualPoint& p, Direction direction, Index pages = 1);
4143 VisualDestinationProxy nextVisualLine(const VisualPoint& p, Direction direction, Index lines = 1);
44+ /// @}
4245 }
4346
4447 // documentation is visual-point.cpp
diff -r 466d227e850f -r 5286f17bd78c ascension/src/kernel/locations.cpp
--- a/ascension/src/kernel/locations.cpp Fri Aug 18 01:39:38 2017 +0900
+++ b/ascension/src/kernel/locations.cpp Fri Aug 18 14:25:32 2017 +0900
@@ -375,10 +375,32 @@
375375
376376 /**
377377 * Adapts the specified position to the document change.
378+ *
379+ * <h3>Insertion</h3>
380+ * When "DEF" is inserted between "abc" and "ghi" ('|' is the position to update):
381+ * <table>
382+ * <tr><th>Gravity</th><th>Before</th><th>After</th></tr>
383+ * <tr><td>Any</td><td><code>a b|c g h i</code></td><td><code>a b|c <em>D E F</em> g h i</code></td></tr>
384+ * <tr><td>Direction#forward()</td><td><code>a b c|g h i</code></td><td><code>a b c <em>D E F</em>|g h i</code></td></tr>
385+ * <tr><td>Direction#backward()</td><td><code>a b c|g h i</code></td><td><code>a b c|<em>D E F</em> g h i</code></td></tr>
386+ * <tr><td>Any</td><td><code>a b c g|h i</code></td><td><code>a b c <em>D E F</em> g|h i</code></td></tr>
387+ * </table>
388+ *
389+ * <h3>Deletion</h3>
390+ * When "DEF" is erased from "abcDEFghi" ('|' is the position to update):
391+ * <table>
392+ * <tr><th>Gravity</th><th>Before</th><th>After</th></tr>
393+ * <tr><td>Any</td><td><code>a b|c <em>D E F</em> g h i</code></td><td><code>a b|c g h i</code></td></tr>
394+ * <tr><td>Any</td><td><code>a b c|<em>D E F</em> g h i</code></td><td><code>a b c|g h i</code></td></tr>
395+ * <tr><td>Any</td><td><code>a b c <em>D</em>|<em>E F</em> g h i</code></td><td><code>a b c|g h i</code></td></tr>
396+ * <tr><td>Any</td><td><code>a b c <em>D E F</em>|g h i</code></td><td><code>a b c|g h i</code></td></tr>
397+ * <tr><td>Any</td><td><code>a b c <em>D E F</em> g|h i</code></td><td><code>a b c g|h i</code></td></tr>
398+ * </table>
399+ *
378400 * @param position The original position
379401 * @param change The content of the document change
380402 * @param gravity The gravity which determines the direction to which the position should move if a text
381- * was inserted at the position. If @c Direction#forward() is specified, the position will
403+ * was inserted at the position. If @c Direction#backward() is specified, the position will
382404 * move to the start of the inserted text (no movement occur). Otherwise, move to the end of
383405 * the inserted text
384406 * @return The result position
@@ -391,8 +413,7 @@
391413 return newPosition;
392414 else // in the region
393415 newPosition = *boost::const_begin(change.erasedRegion());
394- }
395- else if(line(position) > line(*boost::const_end(change.erasedRegion()))) // in front of the current line
416+ } else if(line(position) > line(*boost::const_end(change.erasedRegion()))) // in front of the current line
396417 newPosition.line -= boost::size(change.erasedRegion().lines()) - 1;
397418 else { // the end is the current line
398419 if(line(position) == line(*boost::const_begin(change.erasedRegion()))) // the region is single-line
Show on old repository browser