| 1896 | } |
| 1897 | |
| 1898 | int Document::WordPartLeft(int pos) { |
| 1899 | if (pos > 0) { |
| 1900 | --pos; |
| 1901 | char startChar = cb.CharAt(pos); |
| 1902 | if (IsWordPartSeparator(startChar)) { |
| 1903 | while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { |
| 1904 | --pos; |
| 1905 | } |
| 1906 | } |
| 1907 | if (pos > 0) { |
| 1908 | startChar = cb.CharAt(pos); |
| 1909 | --pos; |
| 1910 | if (IsLowerCase(startChar)) { |
| 1911 | while (pos > 0 && IsLowerCase(cb.CharAt(pos))) |
| 1912 | --pos; |
| 1913 | if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) |
| 1914 | ++pos; |
| 1915 | } else if (IsUpperCase(startChar)) { |
| 1916 | while (pos > 0 && IsUpperCase(cb.CharAt(pos))) |
| 1917 | --pos; |
| 1918 | if (!IsUpperCase(cb.CharAt(pos))) |
| 1919 | ++pos; |
| 1920 | } else if (IsADigit(startChar)) { |
| 1921 | while (pos > 0 && IsADigit(cb.CharAt(pos))) |
| 1922 | --pos; |
| 1923 | if (!IsADigit(cb.CharAt(pos))) |
| 1924 | ++pos; |
| 1925 | } else if (IsPunctuation(startChar)) { |
| 1926 | while (pos > 0 && IsPunctuation(cb.CharAt(pos))) |
| 1927 | --pos; |
| 1928 | if (!IsPunctuation(cb.CharAt(pos))) |
| 1929 | ++pos; |
| 1930 | } else if (isspacechar(startChar)) { |
| 1931 | while (pos > 0 && isspacechar(cb.CharAt(pos))) |
| 1932 | --pos; |
| 1933 | if (!isspacechar(cb.CharAt(pos))) |
| 1934 | ++pos; |
| 1935 | } else if (!isascii(startChar)) { |
| 1936 | while (pos > 0 && !isascii(cb.CharAt(pos))) |
| 1937 | --pos; |
| 1938 | if (isascii(cb.CharAt(pos))) |
| 1939 | ++pos; |
| 1940 | } else { |
| 1941 | ++pos; |
| 1942 | } |
| 1943 | } |
| 1944 | } |
| 1945 | return pos; |
| 1946 | } |
| 1947 | |
| 1948 | int Document::WordPartRight(int pos) { |
| 1949 | char startChar = cb.CharAt(pos); |
no test coverage detected