I know it is hard to stay on track when you are laid up because you have so much extra time on your hands and you can't do much. Just keep in mind how far you have come on your weight loss journey and remember you still want to go further. Don't give yourself permission to overeat, make sure when you are eating it is because you are hungry and not just bored. If you think it is hunger, wait 10-15 minutes and if you are still hungry, eat, just in moderation. Keep things close at hand that can keep idle hands busy, like crossword puzzles, books, writing paper or something like cross stitch (and if you don't cross stitch, buy yourself a project and teach yourself, it is easy). Or maybe you can get a jump on your holiday cards by either addressing all the envelopes or writing the cards or both. The more you keep busy the less you will rely on food. Also, before your surgery cut up some veggies or something healthful that is allowed on whatever program you are following, this way they are ready at hand for the times you want to munch.
Good luck.