• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • vimode
katevirange.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries and the Kate part.
2  *
3  * Copyright (C) 2008 Erlend Hamberg <ehamberg@gmail.com>
4  * Copyright (C) 2011 Svyatoslav Kuzmich <svatoslav1@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #include <QtGlobal>
23 #include "katevirange.h"
24  KateViRange::KateViRange( int slin, int scol, int elin, int ecol, ViMotion::MotionType inc )
25  : startLine( slin ), startColumn( scol ), endLine( elin ), endColumn( ecol ), motionType( inc )
26 {
27  valid = true;
28  jump = false;
29 }
30 
31 // for motions which only return a position, in constrast to "text objects"
32 // which returns a range
33  KateViRange::KateViRange( int elin, int ecol, ViMotion::MotionType inc )
34  : endLine( elin ), endColumn( ecol ), motionType( inc )
35 {
36  startLine = -1;
37  startColumn = -1;
38  valid = true;
39  jump = false;
40 }
41 
42 KateViRange::KateViRange()
43 {
44  startLine = -1;
45  startColumn = -1;
46  endLine = -1;
47  endColumn = -1;
48  valid = true;
49  jump = false;
50  motionType = ViMotion::InclusiveMotion;
51 }
52 
53 void KateViRange::normalize()
54 {
55  int sl = startLine, el = endLine, sc = startColumn, ec = endColumn;
56  if (sl < el){
57  startLine = sl;
58  startColumn = sc;
59  endLine = el;
60  endColumn = ec;
61  } else {
62  startLine = el;
63  endLine = sl;
64  if (sl != el) {
65  startColumn = ec;
66  endColumn = sc;
67  } else {
68  startColumn = qMin(sc, ec);
69  endColumn = qMax(sc, ec);
70  }
71  }
72 }
KateViRange::endLine
int endLine
Definition: katevirange.h:44
katevirange.h
KateViRange::jump
bool jump
Definition: katevirange.h:47
KateViRange::normalize
void normalize()
Definition: katevirange.cpp:53
KateViRange::startColumn
int startColumn
Definition: katevirange.h:41
KateViRange::endColumn
int endColumn
Definition: katevirange.h:44
KateViRange::motionType
ViMotion::MotionType motionType
Definition: katevirange.h:45
ViMotion::MotionType
MotionType
Definition: katevirange.h:28
KateViRange::KateViRange
KateViRange()
Definition: katevirange.cpp:42
KateViRange::valid
bool valid
Definition: katevirange.h:46
ViMotion::InclusiveMotion
Definition: katevirange.h:29
KateViRange::startLine
int startLine
Definition: katevirange.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal